mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
qa: Avoid start/stop of the network thread mid-test
This commit is contained in:
@ -103,8 +103,6 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||
unsupported_service_bit5_node = self.nodes[0].add_p2p_connection(CLazyNode(), services=NODE_NETWORK|NODE_UNSUPPORTED_SERVICE_BIT_5)
|
||||
unsupported_service_bit7_node = self.nodes[0].add_p2p_connection(CLazyNode(), services=NODE_NETWORK|NODE_UNSUPPORTED_SERVICE_BIT_7)
|
||||
|
||||
network_thread_start()
|
||||
|
||||
wait_until(lambda: no_version_bannode.ever_connected, timeout=10, lock=mininode_lock)
|
||||
wait_until(lambda: no_version_idlenode.ever_connected, timeout=10, lock=mininode_lock)
|
||||
wait_until(lambda: no_verack_idlenode.version_received, timeout=10, lock=mininode_lock)
|
||||
@ -126,9 +124,8 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].disconnect_p2ps()
|
||||
|
||||
# Wait until all connections are closed and the network thread has terminated
|
||||
# Wait until all connections are closed
|
||||
wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0)
|
||||
network_thread_join()
|
||||
|
||||
# Make sure no unexpected messages came in
|
||||
assert(no_version_bannode.unexpected_msg == False)
|
||||
@ -143,11 +140,9 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||
allowed_service_bit5_node = self.nodes[0].add_p2p_connection(P2PInterface(), services=NODE_NETWORK|NODE_UNSUPPORTED_SERVICE_BIT_5)
|
||||
allowed_service_bit7_node = self.nodes[0].add_p2p_connection(P2PInterface(), services=NODE_NETWORK|NODE_UNSUPPORTED_SERVICE_BIT_7)
|
||||
|
||||
# Network thread stopped when all previous P2PInterfaces disconnected. Restart it
|
||||
network_thread_start()
|
||||
|
||||
wait_until(lambda: allowed_service_bit5_node.message_count["verack"], lock=mininode_lock)
|
||||
wait_until(lambda: allowed_service_bit7_node.message_count["verack"], lock=mininode_lock)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
P2PLeakTest().main()
|
||||
|
Reference in New Issue
Block a user