From 4207d9bf823bea9f94b484ebf3c9274ca781b245 Mon Sep 17 00:00:00 2001 From: furszy Date: Wed, 25 Jun 2025 17:55:04 -0400 Subject: [PATCH] test: feature_init, ensure indexes are synced prior to perturbing files --- test/functional/feature_init.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/functional/feature_init.py b/test/functional/feature_init.py index 5cf02ffea1c..a7b7e0c6760 100755 --- a/test/functional/feature_init.py +++ b/test/functional/feature_init.py @@ -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")