[wallet] Pass error message back from CWallet::Verify()

Pass an error message back from CWallet::Verify(), and call
InitError/InitWarning from WalletInit::Verify().

This means that we can call CWallet::Verify() independently from
WalletInit and not have InitErrors printed to stdout. It also means that
the error can be reported to the user if dynamic wallet load fails.
This commit is contained in:
John Newbery
2018-04-18 14:17:09 -04:00
parent e0e90db07b
commit 876eb64680
3 changed files with 18 additions and 22 deletions

View File

@@ -207,7 +207,12 @@ bool WalletInit::Verify() const
return InitError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
}
if (!CWallet::Verify(wallet_file, salvage_wallet)) return false;
std::string error_string;
std::string warning_string;
bool verify_success = CWallet::Verify(wallet_file, salvage_wallet, error_string, warning_string);
if (!error_string.empty()) InitError(error_string);
if (!warning_string.empty()) InitWarning(warning_string);
if (!verify_success) return false;
}
return true;