From 876eb64680968c8fe2a28d1ecfd88a08d8967ead Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 18 Apr 2018 14:17:09 -0400 Subject: [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. --- src/wallet/init.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/wallet/init.cpp') diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 01c927f03..5cfa86451 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -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; -- cgit v1.2.3