From eccceaebb1443feb780da0d49895edf16237022a Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 12 May 2022 23:11:50 +0300 Subject: [PATCH] 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*()`. --- src/wallet/wallet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3eb2486aab..ac74b410db 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5030,7 +5030,9 @@ bool CWallet::Verify(interfaces::Chain& chain, const WalletLocation& location, b std::unique_ptr 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::CreateWalletFromFile(interfaces::Chain& chain, const WalletLocation& location, bilingual_str& error, std::vector& warnings, uint64_t wallet_creation_flags)