From faecb72c3ca744f1adb77bd910c643cedec3b445 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 28 Apr 2021 10:06:54 +0200 Subject: [PATCH 1/2] test: Fix intermittent issue in p2p_segwit.py --- test/functional/p2p_segwit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 1b6e122ee46..9d32c1cb86d 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -1966,9 +1966,10 @@ class SegWitTest(BitcoinTestFramework): # Restarting node 2 should result in a shutdown because the blockchain consists of # insufficiently validated blocks per segwit consensus rules. self.stop_node(2) - with self.nodes[2].assert_debug_log(expected_msgs=[ - f"Witness data for blocks after height {SEGWIT_HEIGHT} requires validation. Please restart with -reindex."], timeout=10): - self.nodes[2].start([f"-segwitheight={SEGWIT_HEIGHT}"]) + self.nodes[2].assert_start_raises_init_error( + extra_args=[f"-segwitheight={SEGWIT_HEIGHT}"], + expected_msg=f": Witness data for blocks after height {SEGWIT_HEIGHT} requires validation. Please restart with -reindex..\nPlease restart with -reindex or -reindex-chainstate to recover.", + ) # As directed, the user restarts the node with -reindex self.start_node(2, extra_args=["-reindex", f"-segwitheight={SEGWIT_HEIGHT}"]) From fad6269916dbf8adc14d757a18f19c74e95cf659 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 28 Apr 2021 09:55:34 +0200 Subject: [PATCH 2/2] test: Assert that exit code indicates failure --- test/functional/test_framework/test_node.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index ce9c1bc0245..c17c16f7972 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -491,6 +491,7 @@ class TestNode(): self.start(extra_args, stdout=log_stdout, stderr=log_stderr, *args, **kwargs) ret = self.process.wait(timeout=self.rpc_timeout) self.log.debug(self._node_msg(f'bitcoind exited with status {ret} during initialization')) + assert ret != 0 # Exit code must indicate failure self.running = False self.process = None # Check stderr for expected message