mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#25443: Fail if connect_nodes fails
This commit is contained in:
parent
60b5392d92
commit
d6ce037814
@ -697,6 +697,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
|
||||
from_connection = self.nodes[a]
|
||||
to_connection = self.nodes[b]
|
||||
from_num_peers = 1 + len(from_connection.getpeerinfo())
|
||||
to_num_peers = 1 + len(to_connection.getpeerinfo())
|
||||
ip_port = "127.0.0.1:" + str(p2p_port(b))
|
||||
from_connection.addnode(ip_port, "onetry")
|
||||
# poll until version handshake complete to avoid race conditions
|
||||
@ -704,10 +706,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
# See comments in net_processing:
|
||||
# * Must have a version message before anything else
|
||||
# * Must have a verack message before anything else
|
||||
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()))
|
||||
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()))
|
||||
self.wait_until(lambda: sum(peer['version'] != 0 for peer in from_connection.getpeerinfo()) == from_num_peers)
|
||||
self.wait_until(lambda: sum(peer['version'] != 0 for peer in to_connection.getpeerinfo()) == to_num_peers)
|
||||
self.wait_until(lambda: sum(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()) == from_num_peers)
|
||||
self.wait_until(lambda: sum(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in to_connection.getpeerinfo()) == to_num_peers)
|
||||
|
||||
def disconnect_nodes(self, a, b):
|
||||
# A node cannot disconnect from itself, bail out early
|
||||
@ -740,7 +742,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
raise
|
||||
|
||||
# wait to disconnect
|
||||
wait_until_helper(lambda: not get_peer_ids(), timeout=5)
|
||||
self.wait_until(lambda: not get_peer_ids(), timeout=5)
|
||||
|
||||
disconnect_nodes_helper(self.nodes[a], b)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user