Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_compactblocks.py
Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | def test_compactblock_construction(self, node, test_node): | ||||
self.request_cb_announcements(test_node, node) | self.request_cb_announcements(test_node, node) | ||||
# Now mine a block, and look at the resulting compact block. | # Now mine a block, and look at the resulting compact block. | ||||
test_node.clear_block_announcement() | test_node.clear_block_announcement() | ||||
block_hash = int(node.generate(1)[0], 16) | block_hash = int(node.generate(1)[0], 16) | ||||
# Store the raw block in our internal format. | # Store the raw block in our internal format. | ||||
block = FromHex(CBlock(), node.getblock( | block = FromHex(CBlock(), node.getblock( | ||||
"{:02x}".format(block_hash), False)) | "{:064x}".format(block_hash), False)) | ||||
for tx in block.vtx: | for tx in block.vtx: | ||||
tx.calc_sha256() | tx.calc_sha256() | ||||
block.rehash() | block.rehash() | ||||
# Wait until the block was announced (via compact blocks) | # Wait until the block was announced (via compact blocks) | ||||
wait_until(test_node.received_block_announcement, | wait_until(test_node.received_block_announcement, | ||||
timeout=30, lock=mininode_lock) | timeout=30, lock=mininode_lock) | ||||
▲ Show 20 Lines • Show All 594 Lines • Show Last 20 Lines |