aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p-acceptblock.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-acceptblock.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-acceptblock.py')
-rwxr-xr-xtest/functional/p2p-acceptblock.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/functional/p2p-acceptblock.py b/test/functional/p2p-acceptblock.py
index b56cafc984..bb204322ed 100755
--- a/test/functional/p2p-acceptblock.py
+++ b/test/functional/p2p-acceptblock.py
@@ -207,9 +207,13 @@ class AcceptBlockTest(BitcoinTestFramework):
# disconnect/reconnect first
self.nodes[0].disconnect_p2ps()
- test_node = self.nodes[0].add_p2p_connection(P2PInterface())
+ self.nodes[1].disconnect_p2ps()
+ network_thread_join()
+ test_node = self.nodes[0].add_p2p_connection(P2PInterface())
+ network_thread_start()
test_node.wait_for_verack()
+
test_node.send_message(msg_block(block_h1f))
test_node.sync_with_ping()