mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#22817: Avoid race after connect_nodes
Due to stricter checks, we can no longer start masternodes in parallel, as entities used to process `to_connection` checks are reused before the previous check is completed, resulting in an exception. Since we're now validating the establishment of a two-way connection, we have to do it one at a time.
This commit is contained in:
parent
5a0479fe53
commit
05395ff37b
@ -695,18 +695,19 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
if (a == b):
|
if (a == b):
|
||||||
return
|
return
|
||||||
|
|
||||||
def connect_nodes_helper(from_connection, node_num):
|
from_connection = self.nodes[a]
|
||||||
ip_port = "127.0.0.1:" + str(p2p_port(node_num))
|
to_connection = self.nodes[b]
|
||||||
from_connection.addnode(ip_port, "onetry")
|
ip_port = "127.0.0.1:" + str(p2p_port(b))
|
||||||
# poll until version handshake complete to avoid race conditions
|
from_connection.addnode(ip_port, "onetry")
|
||||||
# with transaction relaying
|
# poll until version handshake complete to avoid race conditions
|
||||||
# See comments in net_processing:
|
# with transaction relaying
|
||||||
# * Must have a version message before anything else
|
# See comments in net_processing:
|
||||||
# * Must have a verack message before anything else
|
# * Must have a version message before anything else
|
||||||
wait_until_helper(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
|
# * Must have a verack message before anything else
|
||||||
wait_until_helper(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()))
|
wait_until_helper(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
|
||||||
|
wait_until_helper(lambda: all(peer['version'] != 0 for peer in to_connection.getpeerinfo()))
|
||||||
connect_nodes_helper(self.nodes[a], b)
|
wait_until_helper(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()))
|
||||||
|
wait_until_helper(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in to_connection.getpeerinfo()))
|
||||||
|
|
||||||
def disconnect_nodes(self, a, b):
|
def disconnect_nodes(self, a, b):
|
||||||
# A node cannot disconnect from itself, bail out early
|
# A node cannot disconnect from itself, bail out early
|
||||||
|
Loading…
Reference in New Issue
Block a user