@@ -654,6 +654,37 @@ bool CWallet::ParameterInteraction()
654654 return UIError (" -sysperms is not allowed in combination with enabled wallet functionality" );
655655 }
656656
657+ gArgs .SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
658+ const bool is_multiwallet = gArgs .GetArgs (" -wallet" ).size () > 1 ;
659+
660+ if (gArgs .GetBoolArg (" -salvagewallet" , false ) && gArgs .SoftSetBoolArg (" -rescan" , true )) {
661+ if (is_multiwallet) {
662+ return UIError (strprintf (" %s is only allowed with a single wallet file" , " -salvagewallet" ));
663+ }
664+ // Rewrite just private keys: rescan to find transactions
665+ LogPrintf (" %s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n " , __func__);
666+ }
667+
668+ int zapwallettxes = gArgs .GetArg (" -zapwallettxes" , 0 );
669+ // -zapwallettxes implies dropping the mempool on startup
670+ if (zapwallettxes != 0 && gArgs .SoftSetBoolArg (" -persistmempool" , false )) {
671+ LogPrintf (" %s: parameter interaction: -zapwallettxes=%s -> setting -persistmempool=0\n " , __func__, zapwallettxes);
672+ }
673+
674+ // -zapwallettxes implies a rescan
675+ if (zapwallettxes != 0 && gArgs .SoftSetBoolArg (" -rescan" , true )) {
676+ if (is_multiwallet) {
677+ return UIError (strprintf (" %s is only allowed with a single wallet file" , " -zapwallettxes" ));
678+ }
679+ LogPrintf (" %s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n " , __func__);
680+ }
681+
682+ if (is_multiwallet) {
683+ if (gArgs .GetBoolArg (" -upgradewallet" , false )) {
684+ return UIError (strprintf (" %s is only allowed with a single wallet file" , " -upgradewallet" ));
685+ }
686+ }
687+
657688 if (gArgs .IsArgSet (" -mintxfee" )) {
658689 CAmount n = 0 ;
659690 if (ParseMoney (gArgs .GetArg (" -mintxfee" , " " ), n) && n > 0 )
@@ -2080,7 +2111,6 @@ bool CWallet::Verify()
20802111 return true ;
20812112 }
20822113
2083- gArgs .SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
20842114 uiInterface.InitMessage (_ (" Verifying wallet(s)..." ));
20852115
20862116 for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
0 commit comments