mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-31 01:04:20 +00:00
Merge #9159: [qa] Wait for specific block announcement in p2p-compactblocks
dfa44d1 [qa] Wait for specific block announcement in p2p-compactblocks (Russell Yanofsky)
This commit is contained in:
commit
44adf683ad
@ -186,12 +186,15 @@ class CompactBlocksTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
def check_announcement_of_new_block(node, peer, predicate):
|
def check_announcement_of_new_block(node, peer, predicate):
|
||||||
peer.clear_block_announcement()
|
peer.clear_block_announcement()
|
||||||
node.generate(1)
|
block_hash = int(node.generate(1)[0], 16)
|
||||||
got_message = wait_until(lambda: peer.block_announced, timeout=30)
|
peer.wait_for_block_announcement(block_hash, timeout=30)
|
||||||
assert(peer.block_announced)
|
assert(peer.block_announced)
|
||||||
assert(got_message)
|
assert(got_message)
|
||||||
|
|
||||||
with mininode_lock:
|
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.
|
# 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)
|
check_announcement_of_new_block(node, test_node, lambda p: p.last_cmpctblock is None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user