aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-03-24 14:27:08 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-03-24 14:27:13 +0100
commit4a0ab355b3e7e7a3fae218fb5d9894fb7f3636a5 (patch)
tree0b1c58a371efc80968fff8b1030b859e8788134d /test
parent7d0e42abce9dd7c0f192928e909a98278a70dd3d (diff)
parentb2813980b81034ff9b40bd45080fa67dea475d39 (diff)
downloadbitcoin-4a0ab355b3e7e7a3fae218fb5d9894fb7f3636a5.tar.xz
Merge bitcoin/bitcoin#24626: init: disallow reindex-chainstate when pruning
b2813980b81034ff9b40bd45080fa67dea475d39 init: disallow reindex-chainstate when pruning (Martin Zumsande) Pull request description: The combination of `-reindex-chainstate` and `-prune` currently makes the node stuck in an endless loop: - `LoadChainstate()` will wipe the existing chainstate (so we have no genesis block anymore). It won't clean up unusable block files by calling `CleanupBlockRevFiles()` as for full `-reindex`. - `ThreadImport()` has [logic](https://github.com/bitcoin/bitcoin/blob/91d12344b1e51809c1ef6b630b631a6da00267c3/src/node/blockstorage.cpp#L855) of reloading Genesis after reindexing. This is what makes full `-reindex` work with `-prune` but it's not executed for `-reindex-chainstate`. - Since we still don't have a genesis block, init will wait for it forever in an endless loop ([code](https://github.com/bitcoin/bitcoin/blob/91d12344b1e51809c1ef6b630b631a6da00267c3/src/init.cpp#L1630-L1640)). Fix this by disallowing `-reindex-chainstate` together with `-prune`. This is discouraged in the help for `-reindex-chainstate` anyway ("When in pruning mode or if blocks on disk might be corrupted, use full -reindex instead.") but wasn't enforced. Fixes #24242 ACKs for top commit: MarcoFalke: cr ACK b2813980b81034ff9b40bd45080fa67dea475d39 Tree-SHA512: 7220842daaf9a4f972d82b13b81fdeac2833bf5e665c5b0f8eaf6a4bcd0725c8e97d19ec956ca4b730065a983475bb3a2732713d338f4caf8666ccbf63d4d988
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_pruning.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py
index ba3c5053cb..bf19384279 100755
--- a/test/functional/feature_pruning.py
+++ b/test/functional/feature_pruning.py
@@ -141,6 +141,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'],
+ )
def test_height_min(self):
assert os.path.isfile(os.path.join(self.prunedir, "blk00000.dat")), "blk00000.dat is missing, pruning too early"