Merge #16459: [qa] Fix race condition in example_test.py

d9ab0ffa38 [qa] Fix race condition in example_test.py (Suhas Daftuar)

Pull request description:

  There's a race between sending a getdata for a bunch of blocks with the node receiving those blocks from a peer, which could cause test failure.  Fix this.

ACKs for top commit:
  MarcoFalke:
    ACK d9ab0ffa38
  laanwj:
    ACK  d9ab0ffa38
  promag:
    ACK d9ab0ffa38.

Tree-SHA512: c891f209eb2492f44e47da52ee6df950ff874ae26d2739011aca940d1caff6cedbac032b6509adbed07044c14fd711ba9d4d0e35c0f70bb2691f2ea4a46672ed
This commit is contained in:
MarcoFalke 2019-07-25 12:54:05 -04:00
commit fcc4025c12
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25

View file

@ -186,12 +186,15 @@ class ExampleTest(BitcoinTestFramework):
self.log.info("Connect node2 and node1")
connect_nodes(self.nodes[1], 2)
self.log.info("Wait for node2 to receive all the blocks from node1")
self.sync_all()
self.log.info("Add P2P connection to node2")
self.nodes[0].disconnect_p2ps()
self.nodes[2].add_p2p_connection(BaseNode())
self.log.info("Wait for node2 reach current tip. Test that it has propagated all the blocks to us")
self.log.info("Test that node2 propagates all the blocks to us")
getdata_request = msg_getdata()
for block in blocks: