mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-03 18:02:36 +02:00
test: Add functional test for continuing a reindex
Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
This commit is contained in:
@@ -73,6 +73,25 @@ class ReindexTest(BitcoinTestFramework):
|
||||
# All blocks should be accepted and processed.
|
||||
assert_equal(self.nodes[0].getblockcount(), 12)
|
||||
|
||||
def continue_reindex_after_shutdown(self):
|
||||
node = self.nodes[0]
|
||||
self.generate(node, 1500)
|
||||
|
||||
# Restart node with reindex and stop reindex as soon as it starts reindexing
|
||||
self.log.info("Restarting node while reindexing..")
|
||||
node.stop_node()
|
||||
with node.busy_wait_for_debug_log([b'initload thread start']):
|
||||
node.start(['-blockfilterindex', '-reindex'])
|
||||
node.wait_for_rpc_connection(wait_for_import=False)
|
||||
node.stop_node()
|
||||
|
||||
# Start node without the reindex flag and verify it does not wipe the indexes data again
|
||||
db_path = node.chain_path / 'indexes' / 'blockfilter' / 'basic' / 'db'
|
||||
with node.assert_debug_log(expected_msgs=[f'Opening LevelDB in {db_path}'], unexpected_msgs=[f'Wiping LevelDB in {db_path}']):
|
||||
node.start(['-blockfilterindex'])
|
||||
node.wait_for_rpc_connection(wait_for_import=False)
|
||||
node.stop_node()
|
||||
|
||||
def run_test(self):
|
||||
self.reindex(False)
|
||||
self.reindex(True)
|
||||
@@ -80,6 +99,7 @@ class ReindexTest(BitcoinTestFramework):
|
||||
self.reindex(True)
|
||||
|
||||
self.out_of_order()
|
||||
self.continue_reindex_after_shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user