merge bitcoin#24626: disallow reindex-chainstate when pruning

This commit is contained in:
Kittywhiskers Van Gogh 2022-03-21 13:13:49 +01:00
parent bcd24a25e3
commit c65ec190c5
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 7 additions and 1 deletions

View File

@ -1156,12 +1156,14 @@ bool AppInitParameterInteraction(const ArgsManager& args)
nLocalServices = ServiceFlags(nLocalServices | NODE_COMPACT_FILTERS); nLocalServices = ServiceFlags(nLocalServices | NODE_COMPACT_FILTERS);
} }
// if using block pruning, then disallow txindex, coinstatsindex and require disabling governance validation
if (args.GetArg("-prune", 0)) { if (args.GetArg("-prune", 0)) {
if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX))
return InitError(_("Prune mode is incompatible with -txindex.")); return InitError(_("Prune mode is incompatible with -txindex."));
if (args.GetBoolArg("-coinstatsindex", DEFAULT_COINSTATSINDEX)) if (args.GetBoolArg("-coinstatsindex", DEFAULT_COINSTATSINDEX))
return InitError(_("Prune mode is incompatible with -coinstatsindex.")); return InitError(_("Prune mode is incompatible with -coinstatsindex."));
if (args.GetBoolArg("-reindex-chainstate", false)) {
return InitError(_("Prune mode is incompatible with -reindex-chainstate. Use full -reindex instead."));
}
if (!args.GetBoolArg("-disablegovernance", !DEFAULT_GOVERNANCE_ENABLE)) { if (!args.GetBoolArg("-disablegovernance", !DEFAULT_GOVERNANCE_ENABLE)) {
return InitError(_("Prune mode is incompatible with -disablegovernance=false.")); return InitError(_("Prune mode is incompatible with -disablegovernance=false."));
} }

View File

@ -153,6 +153,10 @@ class PruneTest(BitcoinTestFramework):
expected_msg='Error: Prune mode is incompatible with -coinstatsindex.', expected_msg='Error: Prune mode is incompatible with -coinstatsindex.',
extra_args=['-prune=550', '-coinstatsindex'], extra_args=['-prune=550', '-coinstatsindex'],
) )
self.nodes[0].assert_start_raises_init_error(
expected_msg='Error: Prune mode is incompatible with -reindex-chainstate. Use full -reindex instead.',
extra_args=['-prune=550', '-reindex-chainstate'],
)
self.nodes[0].assert_start_raises_init_error( self.nodes[0].assert_start_raises_init_error(
expected_msg='Error: Prune mode is incompatible with -disablegovernance=false.', expected_msg='Error: Prune mode is incompatible with -disablegovernance=false.',
extra_args=['-prune=550', '-disablegovernance=false'], extra_args=['-prune=550', '-disablegovernance=false'],