wallet: Fix wallet autobackup on start (#4831)

19324 follow-up (merged via 4714) - `AutoBackupWallet()` call was unreachable.

NOTE: It's safe to call it after `Verify()` because 18918 backport moved salvage logic out of `Verify*()`.
This commit is contained in:
UdjinM6 2022-05-12 23:11:50 +03:00 committed by GitHub
parent 4ecc49fb73
commit eccceaebb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5030,7 +5030,9 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b
std::unique_ptr<WalletDatabase> database = CreateWalletDatabase(wallet_path);
try {
return database->Verify(error_string);
if (!database->Verify(error_string)) {
return false;
}
} catch (const fs::filesystem_error& e) {
error_string = Untranslated(strprintf("Error loading wallet %s. %s", location.GetName(), fsbridge::get_filesystem_error_message(e)));
return false;
@ -5041,6 +5043,8 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b
if (!tempWallet->AutoBackupWallet(wallet_path, error_string, warnings) && !error_string.original.empty()) {
return false;
}
return true;
}
std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain, const WalletLocation& location, bilingual_str& error, std::vector<bilingual_str>& warnings, uint64_t wallet_creation_flags)