Skip to content

Commit dd97a52

Browse files
committed
Properly forbid -salvagewallet and -zapwallettxes for multi wallet.
1 parent 7666250 commit dd97a52

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/wallet/wallet.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4033,20 +4033,24 @@ bool CWallet::ParameterInteraction()
40334033
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
40344034
}
40354035

4036-
if (GetBoolArg("-salvagewallet", false) && SoftSetBoolArg("-rescan", true)) {
4036+
if (GetBoolArg("-salvagewallet", false)) {
40374037
if (is_multiwallet) {
40384038
return InitError(strprintf("%s is only allowed with a single wallet file", "-salvagewallet"));
40394039
}
40404040
// Rewrite just private keys: rescan to find transactions
4041-
LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__);
4041+
if (SoftSetBoolArg("-rescan", true)) {
4042+
LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__);
4043+
}
40424044
}
40434045

40444046
// -zapwallettx implies a rescan
4045-
if (GetBoolArg("-zapwallettxes", false) && SoftSetBoolArg("-rescan", true)) {
4047+
if (GetBoolArg("-zapwallettxes", false)) {
40464048
if (is_multiwallet) {
40474049
return InitError(strprintf("%s is only allowed with a single wallet file", "-zapwallettxes"));
40484050
}
4049-
LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
4051+
if (SoftSetBoolArg("-rescan", true)) {
4052+
LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
4053+
}
40504054
}
40514055

40524056
if (is_multiwallet) {

0 commit comments

Comments
 (0)