aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p-leaktests.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-12-07 13:40:39 -0500
committerJohn Newbery <john@johnnewbery.com>2017-12-11 09:17:21 -0500
commit34e08b3510c64e35fc51327562d15d938f4b656e (patch)
treec6f09d62e3a5da99daa809c942e7f8bd7c474558 /test/functional/p2p-leaktests.py
parent74e64f24b8cb701379b34442f21332361dcc91f9 (diff)
downloadbitcoin-34e08b3510c64e35fc51327562d15d938f4b656e.tar.xz
[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.
Diffstat (limited to 'test/functional/p2p-leaktests.py')
-rwxr-xr-xtest/functional/p2p-leaktests.py3
1 files changed, 2 insertions, 1 deletions
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)