[test] Reconnect using v1 P2P when v2 P2P terminates due to magic byte mismatch

- When a v2 TestNode makes an outbound connection to a P2PInterface node
which doesn't support v2 but is advertised as v2 by some malicious
intermediary, the TestNode sends 64 bytes ellswift. The v1 node doesn't
understand this and disconnects. Then the v2 TestNode reconnects by
sending a v1/version message.
This commit is contained in:
stratospher
2022-12-10 12:12:37 +05:30
parent a94e350ac0
commit 382894c3ac
2 changed files with 27 additions and 9 deletions

View File

@@ -702,7 +702,7 @@ class TestNode():
self.addconnection('%s:%d' % (address, port), connection_type)
p2p_conn.p2p_connected_to_node = False
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, **kwargs)()
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=False, **kwargs)()
if connection_type == "feeler":
# feeler connections are closed as soon as the node receives a `version` message