From fd06157d1465d93b960e8be6e8e419295abde9a1 Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Thu, 3 Apr 2025 19:51:46 +0200 Subject: [PATCH] test: Add coverage for restarted node without any block sync --- test/functional/feature_init.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/functional/feature_init.py b/test/functional/feature_init.py index f3572013b37..332e5e3b1cc 100755 --- a/test/functional/feature_init.py +++ b/test/functional/feature_init.py @@ -26,8 +26,8 @@ class InitTest(BitcoinTestFramework): """ def set_test_params(self): - self.setup_clean_chain = False - self.num_nodes = 1 + self.setup_clean_chain = True + self.num_nodes = 2 self.uses_wallet = None def init_stress_test(self): @@ -35,8 +35,10 @@ class InitTest(BitcoinTestFramework): - test terminating initialization after seeing a certain log line. - test removing certain essential files to test startup error paths. """ - self.stop_node(0) + self.start_node(0) node = self.nodes[0] + self.generate(node, 200, sync_fun=self.no_op) + self.stop_node(0) def sigterm_node(): if platform.system() == 'Windows': @@ -290,10 +292,20 @@ class InitTest(BitcoinTestFramework): assert_equal(result["height"], current_height) node.wait_until_stopped() + def init_empty_test(self): + self.log.info("Test that stopping and restarting a node that has done nothing is not causing a failure") + options = [ + [], + ["-txindex=1", "-blockfilterindex=1", "-coinstatsindex=1"], + ] + for option in options: + self.restart_node(1, option) + def run_test(self): self.init_pid_test() self.init_stress_test() self.break_wait_test() + self.init_empty_test() if __name__ == '__main__':