Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-finalize-block.py
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# The node will now accept that chain as the finalized block moved back. | # The node will now accept that chain as the finalized block moved back. | ||||
node.reconsiderblock(alt_node.getbestblockhash()) | node.reconsiderblock(alt_node.getbestblockhash()) | ||||
assert_equal(node.getbestblockhash(), alt_node.getbestblockhash()) | assert_equal(node.getbestblockhash(), alt_node.getbestblockhash()) | ||||
self.log.info("Trigger reorg via block finalization...") | self.log.info("Trigger reorg via block finalization...") | ||||
node.finalizeblock(tip) | node.finalizeblock(tip) | ||||
assert_equal(node.getbestblockhash(), tip) | assert_equal(node.getbestblockhash(), tip) | ||||
assert_equal(node.getfinalizedblock(), tip) | |||||
self.log.info("Try to finalized a block on a competiting fork...") | self.log.info("Try to finalized a block on a competiting fork...") | ||||
assert_raises_rpc_error(-20, RPC_FINALIZE_INVALID_BLOCK_ERROR, | assert_raises_rpc_error(-20, RPC_FINALIZE_INVALID_BLOCK_ERROR, | ||||
node.finalizeblock, alt_node.getbestblockhash()) | node.finalizeblock, alt_node.getbestblockhash()) | ||||
assert_not_equal(node.getfinalizedblock(), alt_node.getbestblockhash()) | |||||
assert_equal(node.getfinalizedblock(), tip) | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
FinalizeBlockTest().main() | FinalizeBlockTest().main() |