Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_assumevalid.py
Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Send blocks to node0. Block 102 will be rejected. | # Send blocks to node0. Block 102 will be rejected. | ||||
self.send_blocks_until_disconnected(p2p0) | self.send_blocks_until_disconnected(p2p0) | ||||
self.assert_blockchain_height(self.nodes[0], 101) | self.assert_blockchain_height(self.nodes[0], 101) | ||||
# Send all blocks to node1. All blocks will be accepted. | # Send all blocks to node1. All blocks will be accepted. | ||||
for i in range(2202): | for i in range(2202): | ||||
p2p1.send_message(msg_block(self.blocks[i])) | p2p1.send_message(msg_block(self.blocks[i])) | ||||
# Syncing 2200 blocks can take a while on slow systems. Give it plenty of time to sync. | # Syncing 2200 blocks can take a while on slow systems. Give it plenty of time to sync. | ||||
p2p1.sync_with_ping(200) | p2p1.sync_with_ping(960) | ||||
assert_equal(self.nodes[1].getblock( | assert_equal(self.nodes[1].getblock( | ||||
self.nodes[1].getbestblockhash())['height'], 2202) | self.nodes[1].getbestblockhash())['height'], 2202) | ||||
# Send blocks to node2. Block 102 will be rejected. | # Send blocks to node2. Block 102 will be rejected. | ||||
self.send_blocks_until_disconnected(p2p2) | self.send_blocks_until_disconnected(p2p2) | ||||
self.assert_blockchain_height(self.nodes[2], 101) | self.assert_blockchain_height(self.nodes[2], 101) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
AssumeValidTest().main() | AssumeValidTest().main() |