mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 11:11:15 +02:00
[test] Check whether v2 TestNode performs downgrading
This commit is contained in:
@ -590,6 +590,13 @@ class P2PInterface(P2PConnection):
|
||||
test_function = lambda: not self.is_connected
|
||||
self.wait_until(test_function, timeout=timeout, check_connected=False)
|
||||
|
||||
def wait_for_reconnect(self, timeout=60):
|
||||
def test_function():
|
||||
if not (self.is_connected and self.last_message.get('version') and self.v2_state is None):
|
||||
return False
|
||||
return True
|
||||
self.wait_until(test_function, timeout=timeout, check_connected=False)
|
||||
|
||||
# Message receiving helper methods
|
||||
|
||||
def wait_for_tx(self, txid, timeout=60):
|
||||
|
@ -736,6 +736,9 @@ class TestNode():
|
||||
supports_v2_p2p = supports_v2_p2p and advertise_v2_p2p
|
||||
p2p_conn.peer_accept_connection(connect_cb=addconnection_callback, connect_id=p2p_idx + 1, net=self.chain, timeout_factor=self.timeout_factor, supports_v2_p2p=supports_v2_p2p, reconnect=reconnect, **kwargs)()
|
||||
|
||||
if reconnect:
|
||||
p2p_conn.wait_for_reconnect()
|
||||
|
||||
if connection_type == "feeler":
|
||||
# feeler connections are closed as soon as the node receives a `version` message
|
||||
p2p_conn.wait_until(lambda: p2p_conn.message_count["version"] == 1, check_connected=False)
|
||||
|
Reference in New Issue
Block a user