mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
Merge #13030: [bugfix] [wallet] Fix zapwallettxes/multiwallet interaction.
1f83839[wallet] [tests] Test disallowed multiwallet params (John Newbery)3476e3c[wallet] Fix zapwallettxes/multiwallet interaction. (John Newbery) Pull request description: `-zapwallettxes` should be disallowed when starting bitcoin in multiwallet mode. There's code in `WalletInit::ParameterInteraction()` to disallow `-zapwallettxes` when running in multiwallet mode. This code functioned as expected when passing the parameter `-zapwallettxes=1`, but not when passing the parameter `-zapwallettxes` (ie without the value specified). Fix that and add a test. The new test in the _[wallet] [tests] Test disallowed multiwallet params_ commit reproduces the bug and should fail against master. Fixes #12505 Tree-SHA512: 6cd921717e9c7d2773ca84c946c310c2adec8430e37cbecdb33a620f510db3058a72bd328411812ba415111bc52a3367b332c9d15a37a92ccfd7ae785d2f32ab
This commit is contained in:
@@ -118,19 +118,19 @@ bool WalletInit::ParameterInteraction() const
|
||||
}
|
||||
}
|
||||
|
||||
int zapwallettxes = gArgs.GetArg("-zapwallettxes", 0);
|
||||
bool zapwallettxes = gArgs.GetBoolArg("-zapwallettxes", false);
|
||||
// -zapwallettxes implies dropping the mempool on startup
|
||||
if (zapwallettxes != 0 && gArgs.SoftSetBoolArg("-persistmempool", false)) {
|
||||
LogPrintf("%s: parameter interaction: -zapwallettxes=%s -> setting -persistmempool=0\n", __func__, zapwallettxes);
|
||||
if (zapwallettxes && gArgs.SoftSetBoolArg("-persistmempool", false)) {
|
||||
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -persistmempool=0\n", __func__);
|
||||
}
|
||||
|
||||
// -zapwallettxes implies a rescan
|
||||
if (zapwallettxes != 0) {
|
||||
if (zapwallettxes) {
|
||||
if (is_multiwallet) {
|
||||
return InitError(strprintf("%s is only allowed with a single wallet file", "-zapwallettxes"));
|
||||
}
|
||||
if (gArgs.SoftSetBoolArg("-rescan", true)) {
|
||||
LogPrintf("%s: parameter interaction: -zapwallettxes=%s -> setting -rescan=1\n", __func__, zapwallettxes);
|
||||
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -rescan=1\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user