diff options
author | stratospher <44024636+stratospher@users.noreply.github.com> | 2023-09-08 19:14:22 +0530 |
---|---|---|
committer | stratospher <44024636+stratospher@users.noreply.github.com> | 2024-01-25 11:10:50 +0530 |
commit | ffe6a56d75c0b47d0729e4e0b7225a827b43ad89 (patch) | |
tree | 0a8a05b8d7277bce0ce881432023a9242b04444d /test/functional/test_framework | |
parent | ba737358a37438c18f0fba723eab10ccfd9aae9b (diff) | |
download | bitcoin-ffe6a56d75c0b47d0729e4e0b7225a827b43ad89.tar.xz |
[test] Check whether v2 TestNode performs downgrading
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-x | test/functional/test_framework/p2p.py | 7 | ||||
-rwxr-xr-x | test/functional/test_framework/test_node.py | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py index 1194c7c88d..c41abec42d 100755 --- a/test/functional/test_framework/p2p.py +++ b/test/functional/test_framework/p2p.py @@ -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): diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 8662391b93..29796865c2 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -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) |