aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorMartin Zumsande <mzumsande@gmail.com>2023-11-17 17:00:20 -0500
committerMartin Zumsande <mzumsande@gmail.com>2024-02-06 15:59:17 -0500
commit5fc9db504b9ac784019e7e8c215c31abfccb62b6 (patch)
tree643216b103c3a7c13dc84a720bf531254c1919a3 /test/functional
parent592e01398e765bf3c3f4fc106f40c8be373b4bb0 (diff)
downloadbitcoin-5fc9db504b9ac784019e7e8c215c31abfccb62b6.tar.xz
test: enable p2p_sendtxrcncl.py with v2transport
By adding to the test framework a wait until the v2 handshake is completed, so that p2p_sendtxrcncl.py (which doesn't need to be changed itself) doesnt't send out any other messages before that.
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/p2p_v2_earlykeyresponse.py2
-rwxr-xr-xtest/functional/test_framework/test_node.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/p2p_v2_earlykeyresponse.py b/test/functional/p2p_v2_earlykeyresponse.py
index 1f570e6010..32d2e1148a 100755
--- a/test/functional/p2p_v2_earlykeyresponse.py
+++ b/test/functional/p2p_v2_earlykeyresponse.py
@@ -75,7 +75,7 @@ class P2PEarlyKey(BitcoinTestFramework):
self.log.info('Sending first 4 bytes of ellswift which match network magic')
self.log.info('If a response is received, assertion failure would happen in our custom data_received() function')
# send happens in `initiate_v2_handshake()` in `connection_made()`
- peer1 = node0.add_p2p_connection(PeerEarlyKey(), wait_for_verack=False, send_version=False, supports_v2_p2p=True)
+ peer1 = node0.add_p2p_connection(PeerEarlyKey(), wait_for_verack=False, send_version=False, supports_v2_p2p=True, wait_for_v2_handshake=False)
self.wait_until(lambda: peer1.connection_opened)
self.log.info('Sending remaining ellswift and garbage which are different from V1_PREFIX. Since a response is')
self.log.info('expected now, our custom data_received() function wouldn\'t result in assertion failure')
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 838dcba141..660f8f90cc 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -667,7 +667,7 @@ class TestNode():
assert_msg += "with expected error " + expected_msg
self._raise_assertion_error(assert_msg)
- def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, send_version=True, supports_v2_p2p=False, **kwargs):
+ def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, send_version=True, supports_v2_p2p=False, wait_for_v2_handshake=True, **kwargs):
"""Add an inbound p2p connection to the node.
This method adds the p2p connection to the self.p2ps list and also
@@ -693,6 +693,8 @@ class TestNode():
self.p2ps.append(p2p_conn)
p2p_conn.wait_until(lambda: p2p_conn.is_connected, check_connected=False)
+ if supports_v2_p2p and wait_for_v2_handshake:
+ p2p_conn.wait_until(lambda: p2p_conn.v2_state.tried_v2_handshake)
if send_version:
p2p_conn.wait_until(lambda: not p2p_conn.on_connection_send_msg)
if wait_for_verack:
@@ -771,6 +773,8 @@ class TestNode():
p2p_conn.wait_for_connect()
self.p2ps.append(p2p_conn)
+ if supports_v2_p2p:
+ p2p_conn.wait_until(lambda: p2p_conn.v2_state.tried_v2_handshake)
p2p_conn.wait_until(lambda: not p2p_conn.on_connection_send_msg)
if wait_for_verack:
p2p_conn.wait_for_verack()