def check_announcement_of_new_block(node, peer, predicate):
    peer.clear_block_announcement()
    block_hash = int(node.generate(1)[0], 16)
    peer.wait_for_block_announcement(block_hash, timeout=30)
    assert peer.block_announced
    with mininode_lock:
        assert predicate(peer), 'block_hash={!r}, cmpctblock={!r}, inv={!r}'.format(block_hash, peer.last_message.get('cmpctblock', None), peer.last_message.get('inv', None))
def check_announcement_of_new_block(node, peer, predicate):
    peer.clear_block_announcement()
    block_hash = int(node.generate(1)[0], 16)
    peer.wait_for_block_announcement(block_hash, timeout=30)
    assert peer.block_announced
    with mininode_lock:
        assert predicate(peer), 'block_hash={!r}, cmpctblock={!r}, inv={!r}'.format(block_hash, peer.last_message.get('cmpctblock', None), peer.last_message.get('inv', None))