Skip to content

Commit 5fc9db5

Browse files
committed
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.
1 parent 592e013 commit 5fc9db5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test/functional/p2p_v2_earlykeyresponse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def run_test(self):
7575
self.log.info('Sending first 4 bytes of ellswift which match network magic')
7676
self.log.info('If a response is received, assertion failure would happen in our custom data_received() function')
7777
# send happens in `initiate_v2_handshake()` in `connection_made()`
78-
peer1 = node0.add_p2p_connection(PeerEarlyKey(), wait_for_verack=False, send_version=False, supports_v2_p2p=True)
78+
peer1 = node0.add_p2p_connection(PeerEarlyKey(), wait_for_verack=False, send_version=False, supports_v2_p2p=True, wait_for_v2_handshake=False)
7979
self.wait_until(lambda: peer1.connection_opened)
8080
self.log.info('Sending remaining ellswift and garbage which are different from V1_PREFIX. Since a response is')
8181
self.log.info('expected now, our custom data_received() function wouldn\'t result in assertion failure')

test/functional/test_framework/test_node.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
667667
assert_msg += "with expected error " + expected_msg
668668
self._raise_assertion_error(assert_msg)
669669

670-
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, send_version=True, supports_v2_p2p=False, **kwargs):
670+
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, send_version=True, supports_v2_p2p=False, wait_for_v2_handshake=True, **kwargs):
671671
"""Add an inbound p2p connection to the node.
672672
673673
This method adds the p2p connection to the self.p2ps list and also
@@ -693,6 +693,8 @@ def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, send_version=Tru
693693

694694
self.p2ps.append(p2p_conn)
695695
p2p_conn.wait_until(lambda: p2p_conn.is_connected, check_connected=False)
696+
if supports_v2_p2p and wait_for_v2_handshake:
697+
p2p_conn.wait_until(lambda: p2p_conn.v2_state.tried_v2_handshake)
696698
if send_version:
697699
p2p_conn.wait_until(lambda: not p2p_conn.on_connection_send_msg)
698700
if wait_for_verack:
@@ -771,6 +773,8 @@ def addconnection_callback(address, port):
771773
p2p_conn.wait_for_connect()
772774
self.p2ps.append(p2p_conn)
773775

776+
if supports_v2_p2p:
777+
p2p_conn.wait_until(lambda: p2p_conn.v2_state.tried_v2_handshake)
774778
p2p_conn.wait_until(lambda: not p2p_conn.on_connection_send_msg)
775779
if wait_for_verack:
776780
p2p_conn.wait_for_verack()

0 commit comments

Comments
 (0)