@@ -2080,40 +2080,44 @@ bool CWallet::Verify()
2080
2080
return true ;
2081
2081
}
2082
2082
2083
- uiInterface.InitMessage (_ (" Verifying wallet..." ));
2084
- std::string walletFile = gArgs .GetArg (" -wallet" , DEFAULT_WALLET_DAT);
2085
- std::string strDataDir = GetDataDir ().string ();
2086
-
2087
- std::string strError;
2088
- if (!CWalletDB::VerifyEnvironment (walletFile, GetDataDir ().string (), strError))
2089
- return UIError (strError);
2090
-
2091
- if (gArgs .GetBoolArg (" -salvagewallet" , false )) {
2092
- // Recover readable keypairs:
2093
- CWallet dummyWallet;
2094
- // Even if we don't use this lock in this function, we want to preserve
2095
- // lock order in LoadToWallet if query of chain state is needed to know
2096
- // tx status. If lock can't be taken, tx confirmation status may be not
2097
- // reliable.
2098
- LOCK (cs_main);
2099
- if (!CWalletDB::Recover (walletFile, (void *)&dummyWallet, CWalletDB::RecoverKeysOnlyFilter))
2100
- return false ;
2101
- }
2083
+ gArgs .SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
2084
+ uiInterface.InitMessage (_ (" Verifying wallet(s)..." ));
2102
2085
2103
- std::string strWarning;
2104
- bool dbV = CWalletDB::VerifyDatabaseFile (walletFile, GetDataDir ().string (), strWarning, strError);
2105
- if (!strWarning.empty ()) {
2106
- UIWarning (strWarning);
2107
- }
2108
- if (!dbV) {
2109
- UIError (strError);
2110
- return false ;
2086
+ for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
2087
+ if (fs::path (walletFile).filename () != walletFile) {
2088
+ return UIError (_ (" -wallet parameter must only specify a filename (not a path)" ));
2089
+ } else if (SanitizeString (walletFile, SAFE_CHARS_FILENAME) != walletFile) {
2090
+ return UIError (_ (" Invalid characters in -wallet filename" ));
2091
+ }
2092
+
2093
+ std::string strError;
2094
+ if (!CWalletDB::VerifyEnvironment (walletFile, GetDataDir ().string (), strError))
2095
+ return UIError (strError);
2096
+
2097
+ if (gArgs .GetBoolArg (" -salvagewallet" , false )) {
2098
+ // Recover readable keypairs:
2099
+ CWallet dummyWallet;
2100
+ // Even if we don't use this lock in this function, we want to preserve
2101
+ // lock order in LoadToWallet if query of chain state is needed to know
2102
+ // tx status. If lock can't be taken, tx confirmation status may be not
2103
+ // reliable.
2104
+ LOCK (cs_main);
2105
+ if (!CWalletDB::Recover (walletFile, (void *)&dummyWallet, CWalletDB::RecoverKeysOnlyFilter))
2106
+ return false ;
2107
+ }
2108
+
2109
+ std::string strWarning;
2110
+ bool dbV = CWalletDB::VerifyDatabaseFile (walletFile, GetDataDir ().string (), strWarning, strError);
2111
+ if (!strWarning.empty ())
2112
+ UIWarning (strWarning);
2113
+ if (!dbV) {
2114
+ return UIError (strError);
2115
+ }
2111
2116
}
2117
+
2112
2118
return true ;
2113
2119
}
2114
2120
2115
-
2116
-
2117
2121
void CWallet::ResendWalletTransactions (CConnman* connman)
2118
2122
{
2119
2123
// Do this infrequently and randomly to avoid giving away
@@ -4348,15 +4352,7 @@ bool CWallet::InitLoadWallet()
4348
4352
return true ;
4349
4353
}
4350
4354
4351
- gArgs .SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
4352
-
4353
4355
for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
4354
- if (fs::path (walletFile).filename () != walletFile) {
4355
- return UIError (_ (" -wallet parameter must only specify a filename (not a path)" ));
4356
- } else if (SanitizeString (walletFile, SAFE_CHARS_FILENAME) != walletFile) {
4357
- return UIError (_ (" Invalid characters in -wallet filename" ));
4358
- }
4359
-
4360
4356
// automatic backups
4361
4357
std::string strWarning, strError;
4362
4358
if (!AutoBackupWallet (walletFile, strWarning, strError)) {
0 commit comments