mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-12 13:44:50 +02:00
init: disallow reindex-chainstate with optional indexes
It currently leads to corruption (coinstatsindex) or data duplication (blockfilterindex), so disable it.
This commit is contained in:
@ -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")
|
||||
|
||||
|
@ -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."""
|
||||
|
Reference in New Issue
Block a user