From 34e08b3510c64e35fc51327562d15d938f4b656e Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 7 Dec 2017 13:40:39 -0500 Subject: [tests] Fix network threading in functional tests assumevalid.py, example_test.py and p2p-acceptblocks.py add p2p_connections after the NetworkThread has been started. This isn't permitted. Fix test to restart the network thread when adding new connections. p2p-leaktest.py had a potential race condition if the NetworkThread hadn't terminated by the time we tried to restart it. --- test/functional/p2p-leaktests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/functional/p2p-leaktests.py') diff --git a/test/functional/p2p-leaktests.py b/test/functional/p2p-leaktests.py index 9b59d753f9..ce4e6e9144 100755 --- a/test/functional/p2p-leaktests.py +++ b/test/functional/p2p-leaktests.py @@ -126,8 +126,9 @@ class P2PLeakTest(BitcoinTestFramework): self.nodes[0].disconnect_p2ps() - # Wait until all connections are closed + # Wait until all connections are closed and the network thread has terminated 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) -- cgit v1.2.3