diff options
| author | Luke Dashjr <[email protected]> | 2017-06-05 22:21:20 +0000 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2017-06-06 21:20:22 +0000 |
| commit | 9cbe8c80bad1b55557a91db65a06b66ec4743f18 (patch) | |
| tree | 9f020f49a7afee09deacfb9e031018bc2e0adac5 /src/wallet/wallet.cpp | |
| parent | wallet: Base backup filenames on original wallet filename (diff) | |
| download | discoin-9cbe8c80bad1b55557a91db65a06b66ec4743f18.tar.xz discoin-9cbe8c80bad1b55557a91db65a06b66ec4743f18.zip | |
wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets
Diffstat (limited to 'src/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
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=<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)) |