Skip to content

Commit

Permalink
Properly forbid -salvagewallet and -zapwallettxes for multi wallet.
Browse files Browse the repository at this point in the history
  • Loading branch information
morcos committed Jul 13, 2017
1 parent 7666250 commit dd97a52
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/wallet/wallet.cpp
Expand Up @@ -4033,20 +4033,24 @@ bool CWallet::ParameterInteraction()
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
}

if (GetBoolArg("-salvagewallet", false) && SoftSetBoolArg("-rescan", true)) {
if (GetBoolArg("-salvagewallet", false)) {
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__);
if (SoftSetBoolArg("-rescan", true)) {
LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__);
}
}

// -zapwallettx implies a rescan
if (GetBoolArg("-zapwallettxes", false) && SoftSetBoolArg("-rescan", true)) {
if (GetBoolArg("-zapwallettxes", false)) {
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 (SoftSetBoolArg("-rescan", true)) {
LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
}
}

if (is_multiwallet) {
Expand Down

0 comments on commit dd97a52

Please sign in to comment.