mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
test: Fix restart node race
This commit is contained in:
parent
f0913f2f95
commit
fab46b34f4
2 changed files with 5 additions and 3 deletions
|
@ -517,13 +517,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||||
def stop_node(self, i, expected_stderr='', wait=0):
|
def stop_node(self, i, expected_stderr='', wait=0):
|
||||||
"""Stop a bitcoind test node"""
|
"""Stop a bitcoind test node"""
|
||||||
self.nodes[i].stop_node(expected_stderr, wait=wait)
|
self.nodes[i].stop_node(expected_stderr, wait=wait)
|
||||||
self.nodes[i].wait_until_stopped()
|
|
||||||
|
|
||||||
def stop_nodes(self, wait=0):
|
def stop_nodes(self, wait=0):
|
||||||
"""Stop multiple bitcoind test nodes"""
|
"""Stop multiple bitcoind test nodes"""
|
||||||
for node in self.nodes:
|
for node in self.nodes:
|
||||||
# Issue RPC to stop nodes
|
# Issue RPC to stop nodes
|
||||||
node.stop_node(wait=wait)
|
node.stop_node(wait=wait, wait_until_stopped=False)
|
||||||
|
|
||||||
for node in self.nodes:
|
for node in self.nodes:
|
||||||
# Wait for nodes to stop
|
# Wait for nodes to stop
|
||||||
|
|
|
@ -308,7 +308,7 @@ class TestNode():
|
||||||
def version_is_at_least(self, ver):
|
def version_is_at_least(self, ver):
|
||||||
return self.version is None or self.version >= ver
|
return self.version is None or self.version >= ver
|
||||||
|
|
||||||
def stop_node(self, expected_stderr='', wait=0):
|
def stop_node(self, expected_stderr='', *, wait=0, wait_until_stopped=True):
|
||||||
"""Stop the node."""
|
"""Stop the node."""
|
||||||
if not self.running:
|
if not self.running:
|
||||||
return
|
return
|
||||||
|
@ -337,6 +337,9 @@ class TestNode():
|
||||||
|
|
||||||
del self.p2ps[:]
|
del self.p2ps[:]
|
||||||
|
|
||||||
|
if wait_until_stopped:
|
||||||
|
self.wait_until_stopped()
|
||||||
|
|
||||||
def is_node_stopped(self):
|
def is_node_stopped(self):
|
||||||
"""Checks whether the node has stopped.
|
"""Checks whether the node has stopped.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue