Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_node.py
Show First 20 Lines • Show All 673 Lines • ▼ Show 20 Lines | def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs): | ||||
if 'dstaddr' not in kwargs: | if 'dstaddr' not in kwargs: | ||||
kwargs['dstaddr'] = '127.0.0.1' | kwargs['dstaddr'] = '127.0.0.1' | ||||
p2p_conn.peer_connect( | p2p_conn.peer_connect( | ||||
**kwargs, | **kwargs, | ||||
net=self.chain, | net=self.chain, | ||||
timeout_factor=self.timeout_factor)() | timeout_factor=self.timeout_factor)() | ||||
self.p2ps.append(p2p_conn) | self.p2ps.append(p2p_conn) | ||||
p2p_conn.wait_until( | |||||
lambda: p2p_conn.is_connected, | |||||
check_connected=False) | |||||
if wait_for_verack: | if wait_for_verack: | ||||
# Wait for the node to send us the version and verack | # Wait for the node to send us the version and verack | ||||
p2p_conn.wait_for_verack() | p2p_conn.wait_for_verack() | ||||
# At this point we have sent our version message and received the version and verack, however the full node | # At this point we have sent our version message and received the version and verack, however the full node | ||||
# has not yet received the verack from us (in reply to their version). So, the connection is not yet fully | # has not yet received the verack from us (in reply to their version). So, the connection is not yet fully | ||||
# established (fSuccessfullyConnected). | # established (fSuccessfullyConnected). | ||||
# | # | ||||
# This shouldn't lead to any issues when sending messages, since the verack will be in-flight before the | # This shouldn't lead to any issues when sending messages, since the verack will be in-flight before the | ||||
▲ Show 20 Lines • Show All 222 Lines • Show Last 20 Lines |