mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
test: set P2PConnection.p2p_connected_to_node in peer_connect_helper()
Set `P2PConnection.p2p_connected_to_node` in `P2PConnection.peer_connect_helper()` instead of `TestNode.add_p2p_connection()` and `TestNode.add_outbound_p2p_connection()`. This way tests can create an instance of `P2PConnection` and use `P2PConnection.peer_connect_helper()` directly.
This commit is contained in:
@@ -188,6 +188,7 @@ class P2PConnection(asyncio.Protocol):
|
||||
self.on_connection_send_msg = None
|
||||
self.recvbuf = b""
|
||||
self.magic_bytes = MAGIC_BYTES[net]
|
||||
self.p2p_connected_to_node = dstport != 0
|
||||
|
||||
def peer_connect(self, dstaddr, dstport, *, net, timeout_factor, supports_v2_p2p):
|
||||
self.peer_connect_helper(dstaddr, dstport, net, timeout_factor)
|
||||
|
||||
Reference in New Issue
Block a user