Skip to content

Commit cc2a5ef

Browse files
committed
Merge #20683: test: Fix restart node race
fab46b3 test: Fix restart node race (MarcoFalke) Pull request description: It is not allowed to start a node before it has been fully stopped. Otherwise it could lead to intermittent issues due to access issues (e.g. cookie file https://cirrus-ci.com/task/6409665024098304?command=ci#L4793) Fix that by waiting for the node to fully stop. ACKs for top commit: laanwj: code review ACK fab46b3 Tree-SHA512: 7605cac0573a7b04f05ff110d0131e8940d87f7baf6d698505ed16b363d4d15b1e552c5ffd1a187c8fe5639f7e265c3122734c85283275746e46bd789614fd21
2 parents 2556a97 + fab46b3 commit cc2a5ef

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,12 @@ def start_nodes(self, extra_args=None, *args, **kwargs):
517517
def stop_node(self, i, expected_stderr='', wait=0):
518518
"""Stop a bitcoind test node"""
519519
self.nodes[i].stop_node(expected_stderr, wait=wait)
520-
self.nodes[i].wait_until_stopped()
521520

522521
def stop_nodes(self, wait=0):
523522
"""Stop multiple bitcoind test nodes"""
524523
for node in self.nodes:
525524
# Issue RPC to stop nodes
526-
node.stop_node(wait=wait)
525+
node.stop_node(wait=wait, wait_until_stopped=False)
527526

528527
for node in self.nodes:
529528
# Wait for nodes to stop

test/functional/test_framework/test_node.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def get_wallet_rpc(self, wallet_name):
308308
def version_is_at_least(self, ver):
309309
return self.version is None or self.version >= ver
310310

311-
def stop_node(self, expected_stderr='', wait=0):
311+
def stop_node(self, expected_stderr='', *, wait=0, wait_until_stopped=True):
312312
"""Stop the node."""
313313
if not self.running:
314314
return
@@ -337,6 +337,9 @@ def stop_node(self, expected_stderr='', wait=0):
337337

338338
del self.p2ps[:]
339339

340+
if wait_until_stopped:
341+
self.wait_until_stopped()
342+
340343
def is_node_stopped(self):
341344
"""Checks whether the node has stopped.
342345

0 commit comments

Comments
 (0)