aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/init.cpp
diff options
context:
space:
mode:
authorJohn Newbery <[email protected]>2018-04-18 14:17:09 -0400
committerJohn Newbery <[email protected]>2018-05-16 11:59:58 -0400
commit876eb64680968c8fe2a28d1ecfd88a08d8967ead (patch)
treedb3bbc04d2c7b5d3c992bc4fb02090a61623a78f /src/wallet/init.cpp
parent[wallet] Add CWallet::Verify function (diff)
downloaddiscoin-876eb64680968c8fe2a28d1ecfd88a08d8967ead.tar.xz
discoin-876eb64680968c8fe2a28d1ecfd88a08d8967ead.zip
[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.
Diffstat (limited to 'src/wallet/init.cpp')
-rw-r--r--src/wallet/init.cpp7
1 files changed, 6 insertions, 1 deletions
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;