From c65ec190c562eba578b2c17ec9809bd6e2f0225d Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 21 Mar 2022 13:13:49 +0100 Subject: [PATCH] merge bitcoin#24626: disallow reindex-chainstate when pruning --- src/init.cpp | 4 +++- test/functional/feature_pruning.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 16c7f04860..2887cfc1ea 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1156,12 +1156,14 @@ bool AppInitParameterInteraction(const ArgsManager& args) 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.GetBoolArg("-txindex", DEFAULT_TXINDEX)) return InitError(_("Prune mode is incompatible with -txindex.")); if (args.GetBoolArg("-coinstatsindex", DEFAULT_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)) { return InitError(_("Prune mode is incompatible with -disablegovernance=false.")); } diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 2f62ae0058..e96584f0cb 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -153,6 +153,10 @@ class PruneTest(BitcoinTestFramework): expected_msg='Error: Prune mode is incompatible with -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( expected_msg='Error: Prune mode is incompatible with -disablegovernance=false.', extra_args=['-prune=550', '-disablegovernance=false'],