merge bitcoin#25123: Fix race condition in index prune test

This commit is contained in:
Kittywhiskers Van Gogh 2022-05-13 00:51:48 +02:00
parent baf6e26eed
commit e6867a35ce
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -8,7 +8,6 @@ from test_framework.util import (
assert_equal, assert_equal,
assert_greater_than, assert_greater_than,
assert_raises_rpc_error, assert_raises_rpc_error,
p2p_port,
) )
from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE
@ -134,11 +133,11 @@ class FeatureIndexPruneTest(BitcoinTestFramework):
self.nodes[i].assert_start_raises_init_error(extra_args=self.extra_args[i], expected_msg=f"{EXPECTED_STDERR_NO_GOV_PRUNE}\n{msg}") self.nodes[i].assert_start_raises_init_error(extra_args=self.extra_args[i], expected_msg=f"{EXPECTED_STDERR_NO_GOV_PRUNE}\n{msg}")
self.log.info("make sure the nodes start again with the indices and an additional -reindex arg") self.log.info("make sure the nodes start again with the indices and an additional -reindex arg")
ip_port = "127.0.0.1:" + str(p2p_port(3))
for i in range(3): for i in range(3):
# The nodes need to be reconnected to the non-pruning node upon restart, otherwise they will be stuck restart_args = self.extra_args[i]+["-reindex"]
restart_args = self.extra_args[i]+["-reindex", f"-connect={ip_port}"]
self.restart_node(i, extra_args=restart_args, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) self.restart_node(i, extra_args=restart_args, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
# The nodes need to be reconnected to the non-pruning node upon restart, otherwise they will be stuck
self.connect_nodes(i, 3)
self.sync_blocks(timeout=300) self.sync_blocks(timeout=300)