walletdb: Combine VerifyDatabaseFile and VerifyEnvironment

Combine these two functions into a single Verify function that is a
member of WalletDatabase. Additionally, these are no longer static.
This commit is contained in:
Andrew Chow
2020-06-15 14:37:29 -04:00
parent dbd7a91fdf
commit 8f1bcf8b7b
7 changed files with 16 additions and 42 deletions

View File

@@ -112,7 +112,7 @@ static bool SalvageWallet(const fs::path& path)
// Initialize the environment before recovery
bilingual_str error_string;
try {
WalletBatch::VerifyEnvironment(path, error_string);
database->Verify(error_string);
} catch (const fs::filesystem_error& e) {
error_string = Untranslated(strprintf("Error loading wallet. %s", fsbridge::get_filesystem_error_message(e)));
}
@@ -140,11 +140,6 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
tfm::format(std::cerr, "Error: no wallet file at %s\n", name);
return false;
}
bilingual_str error;
if (!WalletBatch::VerifyEnvironment(path, error)) {
tfm::format(std::cerr, "%s\nError loading %s. Is wallet being used by other process?\n", error.original, name);
return false;
}
if (command == "info") {
std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path);