diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 065748bb9..b3d94e42b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -440,8 +440,6 @@ bool CWallet::Verify() if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) return true; - SoftSetArg("-wallet", DEFAULT_WALLET_DAT); - uiInterface.InitMessage(_("Verifying wallet(s)...")); for (const std::string& walletFile : gArgs.GetArgs("-wallet")) { @@ -3968,6 +3966,9 @@ void CWallet::postInitProcess(CScheduler& scheduler) bool CWallet::ParameterInteraction() { + SoftSetArg("-wallet", DEFAULT_WALLET_DAT); + const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1; + if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) return true; @@ -3976,15 +3977,27 @@ bool CWallet::ParameterInteraction() } if (GetBoolArg("-salvagewallet", false) && SoftSetBoolArg("-rescan", true)) { + if (is_multiwallet) { + return InitError(strprintf("%s is only allowed with a single wallet file", "-salvagewallet")); + } // Rewrite just private keys: rescan to find transactions LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__); } // -zapwallettx implies a rescan if (GetBoolArg("-zapwallettxes", false) && SoftSetBoolArg("-rescan", true)) { + if (is_multiwallet) { + return InitError(strprintf("%s is only allowed with a single wallet file", "-zapwallettxes")); + } LogPrintf("%s: parameter interaction: -zapwallettxes= -> setting -rescan=1\n", __func__); } + if (is_multiwallet) { + if (GetBoolArg("-upgradewallet", false)) { + return InitError(strprintf("%s is only allowed with a single wallet file", "-upgradewallet")); + } + } + if (GetBoolArg("-sysperms", false)) return InitError("-sysperms is not allowed in combination with enabled wallet functionality"); if (GetArg("-prune", 0) && GetBoolArg("-rescan", false))