Browse Source

Merge #8854: [qa] Fix race condition in p2p-compactblocks test

b5fd666 [qa] Fix race condition in p2p-compactblocks test (Suhas Daftuar)
0.14
MarcoFalke 8 years ago
parent
commit
6faffb8a83
No known key found for this signature in database
GPG Key ID: 2D7F2372E50FE137
  1. 2
      qa/rpc-tests/p2p-compactblocks.py
  2. 2
      qa/rpc-tests/test_framework/mininode.py

2
qa/rpc-tests/p2p-compactblocks.py

@ -237,6 +237,8 @@ class CompactBlocksTest(BitcoinTestFramework):
for i in range(num_transactions): for i in range(num_transactions):
self.nodes[0].sendtoaddress(address, 0.1) self.nodes[0].sendtoaddress(address, 0.1)
self.test_node.sync_with_ping()
# Now mine a block, and look at the resulting compact block. # Now mine a block, and look at the resulting compact block.
self.test_node.clear_block_announcement() self.test_node.clear_block_announcement()
block_hash = int(self.nodes[0].generate(1)[0], 16) block_hash = int(self.nodes[0].generate(1)[0], 16)

2
qa/rpc-tests/test_framework/mininode.py

@ -1536,7 +1536,7 @@ class SingleNodeConnCB(NodeConnCB):
def received_pong(): def received_pong():
return (self.last_pong.nonce == self.ping_counter) return (self.last_pong.nonce == self.ping_counter)
self.send_message(msg_ping(nonce=self.ping_counter)) self.send_message(msg_ping(nonce=self.ping_counter))
success = wait_until(received_pong, timeout) success = wait_until(received_pong, timeout=timeout)
self.ping_counter += 1 self.ping_counter += 1
return success return success

Loading…
Cancel
Save