Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_fingerprint.py
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Create longer chain starting 2 blocks before current tip | # Create longer chain starting 2 blocks before current tip | ||||
height = len(block_hashes) - 2 | height = len(block_hashes) - 2 | ||||
block_hash = block_hashes[height - 1] | block_hash = block_hashes[height - 1] | ||||
block_time = self.nodes[0].getblockheader(block_hash)["mediantime"] + 1 | block_time = self.nodes[0].getblockheader(block_hash)["mediantime"] + 1 | ||||
new_blocks = self.build_chain(5, block_hash, height, block_time) | new_blocks = self.build_chain(5, block_hash, height, block_time) | ||||
# Force reorg to a longer chain | # Force reorg to a longer chain | ||||
node0.send_message(msg_headers(new_blocks)) | node0.send_message(msg_headers(new_blocks)) | ||||
node0.wait_for_getdata() | node0.wait_for_getdata([x.sha256 for x in new_blocks]) | ||||
for block in new_blocks: | for block in new_blocks: | ||||
node0.send_and_ping(msg_block(block)) | node0.send_and_ping(msg_block(block)) | ||||
# Check that reorg succeeded | # Check that reorg succeeded | ||||
assert_equal(self.nodes[0].getblockcount(), 13) | assert_equal(self.nodes[0].getblockcount(), 13) | ||||
stale_hash = int(block_hashes[-1], 16) | stale_hash = int(block_hashes[-1], 16) | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |