Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_leak.py
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# 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 | ||||
assert no_version_bannode.state != "connected" | assert not no_version_bannode.is_connected | ||||
self.nodes[0].disconnect_p2ps() | self.nodes[0].disconnect_p2ps() | ||||
# Wait until all connections are closed and the network thread has terminated | # Wait until all connections are closed and the network thread has terminated | ||||
wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0) | wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0) | ||||
network_thread_join() | network_thread_join() | ||||
# Make sure no unexpected messages came in | # Make sure no unexpected messages came in | ||||
assert(no_version_bannode.unexpected_msg == False) | assert(no_version_bannode.unexpected_msg == False) | ||||
assert(no_version_idlenode.unexpected_msg == False) | assert(no_version_idlenode.unexpected_msg == False) | ||||
assert(no_verack_idlenode.unexpected_msg == False) | assert(no_verack_idlenode.unexpected_msg == False) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
P2PLeakTest().main() | P2PLeakTest().main() |