Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_compactblocks.py
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | def test_compactblock_construction(self, node, test_node): | ||||
assert "cmpctblock" in test_node.last_message | assert "cmpctblock" in test_node.last_message | ||||
# Convert the on-the-wire representation to absolute indexes | # Convert the on-the-wire representation to absolute indexes | ||||
header_and_shortids = HeaderAndShortIDs( | header_and_shortids = HeaderAndShortIDs( | ||||
test_node.last_message["cmpctblock"].header_and_shortids) | test_node.last_message["cmpctblock"].header_and_shortids) | ||||
self.check_compactblock_construction_from_block( | self.check_compactblock_construction_from_block( | ||||
header_and_shortids, block_hash, block) | header_and_shortids, block_hash, block) | ||||
# Now fetch the compact block using a normal non-announce getdata | # Now fetch the compact block using a normal non-announce getdata | ||||
with mininode_lock: | |||||
test_node.clear_block_announcement() | test_node.clear_block_announcement() | ||||
inv = CInv(MSG_CMPCT_BLOCK, block_hash) | inv = CInv(MSG_CMPCT_BLOCK, block_hash) | ||||
test_node.send_message(msg_getdata([inv])) | test_node.send_message(msg_getdata([inv])) | ||||
wait_until(test_node.received_block_announcement, | wait_until(test_node.received_block_announcement, | ||||
timeout=30, lock=mininode_lock) | timeout=30, lock=mininode_lock) | ||||
# Now fetch and check the compact block | # Now fetch and check the compact block | ||||
header_and_shortids = None | header_and_shortids = None | ||||
with mininode_lock: | with mininode_lock: | ||||
assert "cmpctblock" in test_node.last_message | assert "cmpctblock" in test_node.last_message | ||||
▲ Show 20 Lines • Show All 564 Lines • Show Last 20 Lines |