Move RecoverDatabaseFile and RecoverKeysOnlyFilter into salvage.{cpp/h}

This commit is contained in:
Andrew Chow
2020-05-15 19:37:55 -04:00
parent b426c7764d
commit 9ea2d258b4
8 changed files with 180 additions and 155 deletions

View File

@@ -885,28 +885,6 @@ void MaybeCompactWalletDB()
fOneThread = false;
}
bool RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, CDataStream ssValue)
{
CWallet *dummyWallet = reinterpret_cast<CWallet*>(callbackData);
std::string strType, strErr;
bool fReadOK;
{
// Required in LoadKeyMetadata():
LOCK(dummyWallet->cs_wallet);
fReadOK = ReadKeyValue(dummyWallet, ssKey, ssValue, strType, strErr);
}
if (!WalletBatch::IsKeyType(strType) && strType != DBKeys::HDCHAIN) {
return false;
}
if (!fReadOK)
{
LogPrintf("WARNING: WalletBatch::Recover skipping %s: %s\n", strType, strErr);
return false;
}
return true;
}
bool WalletBatch::VerifyEnvironment(const fs::path& wallet_path, bilingual_str& errorStr)
{
return BerkeleyBatch::VerifyEnvironment(wallet_path, errorStr);