Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p-leaktests.py
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
connections.append( | connections.append( | ||||
NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], no_verack_idlenode)) | NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], no_verack_idlenode)) | ||||
no_version_bannode.add_connection(connections[0]) | no_version_bannode.add_connection(connections[0]) | ||||
no_version_idlenode.add_connection(connections[1]) | no_version_idlenode.add_connection(connections[1]) | ||||
no_verack_idlenode.add_connection(connections[2]) | no_verack_idlenode.add_connection(connections[2]) | ||||
NetworkThread().start() # Start up network handling in another thread | NetworkThread().start() # Start up network handling in another thread | ||||
assert wait_until( | wait_until(lambda: no_version_bannode.ever_connected, | ||||
lambda: no_version_bannode.ever_connected, timeout=10) | timeout=10, lock=mininode_lock) | ||||
assert wait_until( | wait_until(lambda: no_version_idlenode.ever_connected, | ||||
lambda: no_version_idlenode.ever_connected, timeout=10) | timeout=10, lock=mininode_lock) | ||||
assert wait_until( | wait_until(lambda: no_verack_idlenode.version_received, | ||||
lambda: no_verack_idlenode.version_received, timeout=10) | timeout=10, lock=mininode_lock) | ||||
# Mine a block and make sure that it's not sent to the connected nodes | # Mine a block and make sure that it's not sent to the connected nodes | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
# Give the node enough time to possibly leak out a message | # Give the node enough time to possibly leak out a message | ||||
time.sleep(5) | time.sleep(5) | ||||
# This node should have been banned | # This node should have been banned | ||||
Show All 12 Lines |