Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-parkedchain.py
Show All 40 Lines | def run_test(self): | ||||
parked_tip = node.getbestblockhash() | parked_tip = node.getbestblockhash() | ||||
# get parking_node caught up. | # get parking_node caught up. | ||||
# (probably not needed, but just in case parking can have race | # (probably not needed, but just in case parking can have race | ||||
# condition like invalidateblock below) | # condition like invalidateblock below) | ||||
wait_for_tip(parking_node, parked_tip) | wait_for_tip(parking_node, parked_tip) | ||||
# Let's park the chain. | # Let's park the chain. | ||||
assert(parked_tip != tip) | assert parked_tip != tip | ||||
assert(block_to_park != tip) | assert block_to_park != tip | ||||
assert(block_to_park != parked_tip) | assert block_to_park != parked_tip | ||||
node.parkblock(block_to_park) | node.parkblock(block_to_park) | ||||
assert_equal(node.getbestblockhash(), tip) | assert_equal(node.getbestblockhash(), tip) | ||||
# When the chain is unparked, the node reorg into its original chain. | # When the chain is unparked, the node reorg into its original chain. | ||||
node.unparkblock(parked_tip) | node.unparkblock(parked_tip) | ||||
assert_equal(node.getbestblockhash(), parked_tip) | assert_equal(node.getbestblockhash(), parked_tip) | ||||
# Parking and then unparking a block should not change its validity, | # Parking and then unparking a block should not change its validity, | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
wait_for_tip(parking_node, good_tip) | wait_for_tip(parking_node, good_tip) | ||||
assert_equal(node.getbestblockhash(), parking_node.getbestblockhash()) | assert_equal(node.getbestblockhash(), parking_node.getbestblockhash()) | ||||
# Wait for node 1 to park the chain. | # Wait for node 1 to park the chain. | ||||
def wait_for_parked_block(block): | def wait_for_parked_block(block): | ||||
def check_block(): | def check_block(): | ||||
for tip in parking_node.getchaintips(): | for tip in parking_node.getchaintips(): | ||||
if tip["hash"] == block: | if tip["hash"] == block: | ||||
assert(tip["status"] != "active") | assert tip["status"] != "active" | ||||
return tip["status"] == "parked" | return tip["status"] == "parked" | ||||
return False | return False | ||||
wait_until(check_block) | wait_until(check_block) | ||||
def check_reorg_protection(depth, extra_blocks): | def check_reorg_protection(depth, extra_blocks): | ||||
self.log.info( | self.log.info( | ||||
"Test deep reorg parking, {} block deep".format(depth)) | "Test deep reorg parking, {} block deep".format(depth)) | ||||
Show All 26 Lines |