@@ -440,8 +440,6 @@ bool CWallet::Verify()
440
440
if (GetBoolArg (" -disablewallet" , DEFAULT_DISABLE_WALLET))
441
441
return true ;
442
442
443
- SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
444
-
445
443
uiInterface.InitMessage (_ (" Verifying wallet(s)..." ));
446
444
447
445
for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
@@ -3968,6 +3966,9 @@ void CWallet::postInitProcess(CScheduler& scheduler)
3968
3966
3969
3967
bool CWallet::ParameterInteraction ()
3970
3968
{
3969
+ SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
3970
+ const bool is_multiwallet = gArgs .GetArgs (" -wallet" ).size () > 1 ;
3971
+
3971
3972
if (GetBoolArg (" -disablewallet" , DEFAULT_DISABLE_WALLET))
3972
3973
return true ;
3973
3974
@@ -3976,15 +3977,27 @@ bool CWallet::ParameterInteraction()
3976
3977
}
3977
3978
3978
3979
if (GetBoolArg (" -salvagewallet" , false ) && SoftSetBoolArg (" -rescan" , true )) {
3980
+ if (is_multiwallet) {
3981
+ return InitError (strprintf (" %s is only allowed with a single wallet file" , " -salvagewallet" ));
3982
+ }
3979
3983
// Rewrite just private keys: rescan to find transactions
3980
3984
LogPrintf (" %s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n " , __func__);
3981
3985
}
3982
3986
3983
3987
// -zapwallettx implies a rescan
3984
3988
if (GetBoolArg (" -zapwallettxes" , false ) && SoftSetBoolArg (" -rescan" , true )) {
3989
+ if (is_multiwallet) {
3990
+ return InitError (strprintf (" %s is only allowed with a single wallet file" , " -zapwallettxes" ));
3991
+ }
3985
3992
LogPrintf (" %s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n " , __func__);
3986
3993
}
3987
3994
3995
+ if (is_multiwallet) {
3996
+ if (GetBoolArg (" -upgradewallet" , false )) {
3997
+ return InitError (strprintf (" %s is only allowed with a single wallet file" , " -upgradewallet" ));
3998
+ }
3999
+ }
4000
+
3988
4001
if (GetBoolArg (" -sysperms" , false ))
3989
4002
return InitError (" -sysperms is not allowed in combination with enabled wallet functionality" );
3990
4003
if (GetArg (" -prune" , 0 ) && GetBoolArg (" -rescan" , false ))
0 commit comments