Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-finalize-block.py
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
wait_for_tip(node, alt_node_new_tip) | wait_for_tip(node, alt_node_new_tip) | ||||
assert_equal(node.getbestblockhash(), alt_node.getbestblockhash()) | assert_equal(node.getbestblockhash(), alt_node.getbestblockhash()) | ||||
assert_equal(node.getfinalizedblockhash(), alt_node_tip) | assert_equal(node.getfinalizedblockhash(), alt_node_tip) | ||||
assert_equal(alt_node.getfinalizedblockhash(), alt_node_tip) | assert_equal(alt_node.getfinalizedblockhash(), alt_node_tip) | ||||
self.log.info( | self.log.info( | ||||
"Try to finalize a block on an already finalized chain...") | "Try to finalize a block on an already finalized chain...") | ||||
# Finalizing a block of an already finalized chain should have no effect | # Finalizing a block of an already finalized chain should have no | ||||
# effect | |||||
block_218 = node.getblockheader(alt_node_tip)['previousblockhash'] | block_218 = node.getblockheader(alt_node_tip)['previousblockhash'] | ||||
node.finalizeblock(block_218) | node.finalizeblock(block_218) | ||||
assert_equal(node.getfinalizedblockhash(), alt_node_tip) | assert_equal(node.getfinalizedblockhash(), alt_node_tip) | ||||
self.log.info( | self.log.info( | ||||
"Make sure reconsidering block move the finalization point...") | "Make sure reconsidering block move the finalization point...") | ||||
# Reconsidering the tip will move back the finalized block on node | # Reconsidering the tip will move back the finalized block on node | ||||
# | # | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_equal(node.getfinalizedblockhash(), block_to_autofinalize) | assert_equal(node.getfinalizedblockhash(), block_to_autofinalize) | ||||
assert_equal(alt_node.getfinalizedblockhash(), block_to_autofinalize) | assert_equal(alt_node.getfinalizedblockhash(), block_to_autofinalize) | ||||
self.log.info( | self.log.info( | ||||
"Check that finalization delay is effective on node boot") | "Check that finalization delay is effective on node boot") | ||||
# Restart the new node, so the blocks have no header received time. | # Restart the new node, so the blocks have no header received time. | ||||
self.restart_node(2) | self.restart_node(2) | ||||
# There should be no finalized block (getfinalizedblockhash returns an empty string) | # There should be no finalized block (getfinalizedblockhash returns an | ||||
# empty string) | |||||
assert_equal(delay_node.getfinalizedblockhash(), str()) | assert_equal(delay_node.getfinalizedblockhash(), str()) | ||||
# Generate 20 blocks with no delay. This should not trigger auto-finalization. | # Generate 20 blocks with no delay. This should not trigger auto-finalization. | ||||
# | # | ||||
# Expected state: | # Expected state: | ||||
# | # | ||||
# On delay_node: | # On delay_node: | ||||
# >(220)-> // ->(250 tip) | # >(220)-> // ->(250 tip) | ||||
Show All 29 Lines |