@@ -440,30 +440,40 @@ bool CWallet::Verify()
440
440
if (GetBoolArg (" -disablewallet" , DEFAULT_DISABLE_WALLET))
441
441
return true ;
442
442
443
- uiInterface.InitMessage (_ (" Verifying wallet..." ));
444
- std::string walletFile = GetArg (" -wallet" , DEFAULT_WALLET_DAT);
443
+ SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
445
444
446
- std::string strError;
447
- if (!CWalletDB::VerifyEnvironment (walletFile, GetDataDir ().string (), strError))
448
- return InitError (strError);
445
+ uiInterface.InitMessage (_ (" Verifying wallet(s)..." ));
449
446
450
- if (GetBoolArg (" -salvagewallet" , false ))
451
- {
452
- // Recover readable keypairs:
453
- CWallet dummyWallet;
454
- if (!CWalletDB::Recover (walletFile, (void *)&dummyWallet, CWalletDB::RecoverKeysOnlyFilter))
447
+ for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
448
+ if (boost::filesystem::path (walletFile).filename () != walletFile) {
449
+ return InitError (_ (" -wallet parameter must only specify a filename (not a path)" ));
450
+ } else if (SanitizeString (walletFile, SAFE_CHARS_FILENAME) != walletFile) {
451
+ return InitError (_ (" Invalid characters in -wallet filename" ));
452
+ }
453
+
454
+ std::string strError;
455
+ if (!CWalletDB::VerifyEnvironment (walletFile, GetDataDir ().string (), strError))
456
+ return InitError (strError);
457
+
458
+ if (GetBoolArg (" -salvagewallet" , false ))
459
+ {
460
+ // Recover readable keypairs:
461
+ CWallet dummyWallet;
462
+ if (!CWalletDB::Recover (walletFile, (void *)&dummyWallet, CWalletDB::RecoverKeysOnlyFilter))
463
+ return false ;
464
+ }
465
+
466
+ std::string strWarning;
467
+ bool dbV = CWalletDB::VerifyDatabaseFile (walletFile, GetDataDir ().string (), strWarning, strError);
468
+ if (!strWarning.empty ())
469
+ InitWarning (strWarning);
470
+ if (!dbV)
471
+ {
472
+ InitError (strError);
455
473
return false ;
474
+ }
456
475
}
457
476
458
- std::string strWarning;
459
- bool dbV = CWalletDB::VerifyDatabaseFile (walletFile, GetDataDir ().string (), strWarning, strError);
460
- if (!strWarning.empty ())
461
- InitWarning (strWarning);
462
- if (!dbV)
463
- {
464
- InitError (strError);
465
- return false ;
466
- }
467
477
return true ;
468
478
}
469
479
@@ -3930,15 +3940,7 @@ bool CWallet::InitLoadWallet()
3930
3940
return true ;
3931
3941
}
3932
3942
3933
- SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
3934
-
3935
3943
for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
3936
- if (boost::filesystem::path (walletFile).filename () != walletFile) {
3937
- return InitError (_ (" -wallet parameter must only specify a filename (not a path)" ));
3938
- } else if (SanitizeString (walletFile, SAFE_CHARS_FILENAME) != walletFile) {
3939
- return InitError (_ (" Invalid characters in -wallet filename" ));
3940
- }
3941
-
3942
3944
CWallet * const pwallet = CreateWalletFromFile (walletFile);
3943
3945
if (!pwallet) {
3944
3946
return false ;
0 commit comments