@@ -3990,7 +3990,7 @@ void CWallet::MarkPreSplitKeys()
3990
3990
}
3991
3991
}
3992
3992
3993
- bool CWallet::Verify (std::string wallet_file, bool salvage_wallet)
3993
+ bool CWallet::Verify (std::string wallet_file, bool salvage_wallet, std::string& error_string, std::string& warning_string )
3994
3994
{
3995
3995
// Do some checking on wallet path. It should be either a:
3996
3996
//
@@ -4004,23 +4004,24 @@ bool CWallet::Verify(std::string wallet_file, bool salvage_wallet)
4004
4004
if (!(path_type == fs::file_not_found || path_type == fs::directory_file ||
4005
4005
(path_type == fs::symlink_file && fs::is_directory (wallet_path)) ||
4006
4006
(path_type == fs::regular_file && fs::path (wallet_file).filename () == wallet_file))) {
4007
- return InitError ( strprintf (
4008
- _ ( " Invalid -wallet path '%s'. -wallet path should point to a directory where wallet.dat and "
4007
+ error_string = strprintf (
4008
+ " Invalid -wallet path '%s'. -wallet path should point to a directory where wallet.dat and "
4009
4009
" database/log.?????????? files can be stored, a location where such a directory could be created, "
4010
- " or (for backwards compatibility) the name of an existing data file in -walletdir (%s)" ),
4011
- wallet_file, GetWalletDir ()));
4010
+ " or (for backwards compatibility) the name of an existing data file in -walletdir (%s)" ,
4011
+ wallet_file, GetWalletDir ());
4012
+ return false ;
4012
4013
}
4013
4014
4014
4015
// Make sure that the wallet path doesn't clash with an existing wallet path
4015
4016
for (auto wallet : GetWallets ()) {
4016
4017
if (fs::absolute (wallet->GetName (), GetWalletDir ()) == wallet_path) {
4017
- return InitError (strprintf (_ (" Error loading wallet %s. Duplicate -wallet filename specified." ), wallet_file));
4018
+ error_string = strprintf (" Error loading wallet %s. Duplicate -wallet filename specified." , wallet_file);
4019
+ return false ;
4018
4020
}
4019
4021
}
4020
4022
4021
- std::string strError;
4022
- if (!WalletBatch::VerifyEnvironment (wallet_path, strError)) {
4023
- return InitError (strError);
4023
+ if (!WalletBatch::VerifyEnvironment (wallet_path, error_string)) {
4024
+ return false ;
4024
4025
}
4025
4026
4026
4027
if (salvage_wallet) {
@@ -4032,17 +4033,7 @@ bool CWallet::Verify(std::string wallet_file, bool salvage_wallet)
4032
4033
}
4033
4034
}
4034
4035
4035
- std::string strWarning;
4036
- bool dbV = WalletBatch::VerifyDatabaseFile (wallet_path, strWarning, strError);
4037
- if (!strWarning.empty ()) {
4038
- InitWarning (strWarning);
4039
- }
4040
- if (!dbV) {
4041
- InitError (strError);
4042
- return false ;
4043
- }
4044
-
4045
- return true ;
4036
+ return WalletBatch::VerifyDatabaseFile (wallet_path, warning_string, error_string);
4046
4037
}
4047
4038
4048
4039
CWallet* CWallet::CreateWalletFromFile (const std::string& name, const fs::path& path)
0 commit comments