aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Zumsande <mzumsande@gmail.com>2022-04-06 15:28:46 +0200
committerMartin Zumsande <mzumsande@gmail.com>2022-04-24 22:28:25 +0200
commitdac44fc06ff9938d070aa5221d106a7f31da9d81 (patch)
treee2d3631eb373791eda3b374da2fee406feb00873 /test
parent62e14285f95d4ecb9528813acca975640dd7c598 (diff)
downloadbitcoin-dac44fc06ff9938d070aa5221d106a7f31da9d81.tar.xz
init: disallow reindex-chainstate with optional indexes
It currently leads to corruption (coinstatsindex) or data duplication (blockfilterindex), so disable it.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_coinstatsindex.py14
-rwxr-xr-xtest/functional/p2p_blockfilters.py6
2 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/feature_coinstatsindex.py b/test/functional/feature_coinstatsindex.py
index f865661894..251aa2114b 100755
--- a/test/functional/feature_coinstatsindex.py
+++ b/test/functional/feature_coinstatsindex.py
@@ -223,6 +223,20 @@ class CoinStatsIndexTest(BitcoinTestFramework):
res10 = index_node.gettxoutsetinfo('muhash')
assert(res8['txouts'] < res10['txouts'])
+ self.log.info("Test that the index works with -reindex")
+
+ self.restart_node(1, extra_args=["-coinstatsindex", "-reindex"])
+ res11 = index_node.gettxoutsetinfo('muhash')
+ assert_equal(res11, res10)
+
+ self.log.info("Test that -reindex-chainstate is disallowed with coinstatsindex")
+
+ self.nodes[1].assert_start_raises_init_error(
+ expected_msg='Error: -reindex-chainstate option is not compatible with -coinstatsindex. '
+ 'Please temporarily disable coinstatsindex while using -reindex-chainstate, or replace -reindex-chainstate with -reindex to fully rebuild all indexes.',
+ extra_args=['-coinstatsindex', '-reindex-chainstate'],
+ )
+
def _test_use_index_option(self):
self.log.info("Test use_index option for nodes running the index")
diff --git a/test/functional/p2p_blockfilters.py b/test/functional/p2p_blockfilters.py
index e45cef65bd..2ffc825acd 100755
--- a/test/functional/p2p_blockfilters.py
+++ b/test/functional/p2p_blockfilters.py
@@ -250,6 +250,12 @@ class CompactFiltersTest(BitcoinTestFramework):
msg = "Error: Cannot set -peerblockfilters without -blockfilterindex."
self.nodes[0].assert_start_raises_init_error(expected_msg=msg)
+ self.log.info("Test -blockfilterindex with -reindex-chainstate raises an error")
+ self.nodes[0].assert_start_raises_init_error(
+ expected_msg='Error: -reindex-chainstate option is not compatible with -blockfilterindex. '
+ 'Please temporarily disable blockfilterindex while using -reindex-chainstate, or replace -reindex-chainstate with -reindex to fully rebuild all indexes.',
+ extra_args=['-blockfilterindex', '-reindex-chainstate'],
+ )
def compute_last_header(prev_header, hashes):
"""Compute the last filter header from a starting header and a sequence of filter hashes."""