aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2017-06-05 22:21:20 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2017-06-06 21:20:22 +0000
commit9cbe8c80bad1b55557a91db65a06b66ec4743f18 (patch)
tree9f020f49a7afee09deacfb9e031018bc2e0adac5 /src/wallet
parenta2a5f3f0f06cd3e3cd6203d2ef713360dcb9afe1 (diff)
downloadbitcoin-9cbe8c80bad1b55557a91db65a06b66ec4743f18.tar.xz
wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 065748bb9d..b3d94e42b2 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=<mode> -> 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))