Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p-compactblocks.py
Show First 20 Lines • Show All 285 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("%02x" % block_hash, False)) | block = FromHex(CBlock(), node.getblock("%02x" % block_hash, False)) | ||||
[tx.calc_sha256() for tx in block.vtx] | for tx in block.vtx: | ||||
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) | ||||
# Now fetch and check the compact block | # Now fetch and check the compact block | ||||
header_and_shortids = None | header_and_shortids = None | ||||
▲ Show 20 Lines • Show All 590 Lines • Show Last 20 Lines |