Skip to content

Commit

Permalink
Merge bitcoin#9159: [qa] Wait for specific block announcement in p2p-…
Browse files Browse the repository at this point in the history
…compactblocks

dfa44d1 [qa] Wait for specific block announcement in p2p-compactblocks (Russell Yanofsky)
  • Loading branch information
MarcoFalke committed Nov 19, 2016
2 parents ce612f1 + dfa44d1 commit 44adf68
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions qa/rpc-tests/p2p-compactblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,15 @@ def received_sendcmpct():

def check_announcement_of_new_block(node, peer, predicate):
peer.clear_block_announcement()
node.generate(1)
got_message = wait_until(lambda: peer.block_announced, timeout=30)
block_hash = int(node.generate(1)[0], 16)
peer.wait_for_block_announcement(block_hash, timeout=30)
assert(peer.block_announced)
assert(got_message)

with mininode_lock:
assert(predicate(peer))
assert predicate(peer), (
"block_hash={!r}, cmpctblock={!r}, inv={!r}".format(
block_hash, peer.last_cmpctblock, peer.last_inv))

# We shouldn't get any block announcements via cmpctblock yet.
check_announcement_of_new_block(node, test_node, lambda p: p.last_cmpctblock is None)
Expand Down

0 comments on commit 44adf68

Please sign in to comment.