@@ -654,6 +654,37 @@ bool CWallet::ParameterInteraction()
654
654
return UIError (" -sysperms is not allowed in combination with enabled wallet functionality" );
655
655
}
656
656
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
+
657
688
if (gArgs .IsArgSet (" -mintxfee" )) {
658
689
CAmount n = 0 ;
659
690
if (ParseMoney (gArgs .GetArg (" -mintxfee" , " " ), n) && n > 0 )
@@ -2080,7 +2111,6 @@ bool CWallet::Verify()
2080
2111
return true ;
2081
2112
}
2082
2113
2083
- gArgs .SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
2084
2114
uiInterface.InitMessage (_ (" Verifying wallet(s)..." ));
2085
2115
2086
2116
for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
0 commit comments