mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
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.
This commit is contained in:
parent
592e01398e
commit
5fc9db504b
@ -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')
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user