test: feature_init, ensure indexes are synced prior to perturbing files

This commit is contained in:
furszy
2025-06-25 17:55:04 -04:00
parent abd07cf733
commit 4207d9bf82

View File

@@ -54,11 +54,13 @@ class InitTest(BitcoinTestFramework):
match=ErrorMatch.PARTIAL_REGEX,
)
def check_clean_start():
def check_clean_start(extra_args):
"""Ensure that node restarts successfully after various interrupts."""
node.start()
node.start(extra_args)
node.wait_for_rpc_connection()
assert_equal(200, node.getblockcount())
height = node.getblockcount()
assert_equal(200, height)
self.wait_until(lambda: all(i["synced"] and i["best_block_height"] == height for i in node.getindexinfo().values()))
lines_to_terminate_after = [
b'Validating signatures for all blocks',
@@ -97,7 +99,9 @@ class InitTest(BitcoinTestFramework):
self.log.debug("Terminating node after terminate line was found")
sigterm_node()
check_clean_start()
# Prior to deleting/perturbing index files, start node with all indexes enabled.
# 'check_clean_start' will ensure indexes are synchronized (i.e., data exists to modify)
check_clean_start(args)
self.stop_node(0)
self.log.info("Test startup errors after removing certain essential files")
@@ -186,7 +190,7 @@ class InitTest(BitcoinTestFramework):
self.log.debug(f"Restoring file from {bak_path} and restarting")
Path(bak_path).rename(target_file)
check_clean_start()
check_clean_start(args)
self.stop_node(0)
self.log.info("Test startup errors after perturbing certain essential files")