Skip to content

Commit 208b4aa

Browse files
committed
suggestions
1 parent 26e859f commit 208b4aa

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/functional/feature_llmq_rotation.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def run_test(self):
9898
quorumList = self.test_getmnlistdiff_quorums(b_h_0, b_h_1, {}, expectedDeleted, expectedNew, testQuorumsCLSigs=False)
9999

100100
self.log.info(f"Wait for v20 locked_in phase")
101-
# Expected locked_in phase starts at 1440 - 480 (window size in regtest) + 1
102-
projected_activation_height = self.advance_to_locked_in_for_v20(expected_locked_in_height=961)
101+
# Expected locked_in phase starts at 1440 - 480 (window size in regtest)
102+
projected_activation_height = self.advance_to_locked_in_for_v20(expected_locked_in_height=960)
103103

104104
self.activate_v20(expected_activation_height=1440)
105105
self.log.info("Activated v20 at height:" + str(self.nodes[0].getblockcount()))
@@ -388,19 +388,31 @@ def advance_to_locked_in_for_v20(self, expected_locked_in_height):
388388
batch_size = 10
389389
height = self.nodes[0].getblockcount()
390390
assert_greater_than(expected_locked_in_height, height)
391-
while expected_locked_in_height - height >= batch_size:
391+
# NOTE: getblockchaininfo shows softforks locked_in at block (window * 2 - 1)
392+
# since it's returning whether a softwork is locked_in for the _next_ block.
393+
# Hence the last block prior to the locked_in state is (expected_locked_in_height - 2).
394+
while expected_locked_in_height - height - 2 >= batch_size:
392395
self.bump_mocktime(batch_size)
393396
self.nodes[0].generate(batch_size)
394397
height += batch_size
395398
self.sync_blocks()
396-
blocks_left = expected_locked_in_height - height
399+
blocks_left = expected_locked_in_height - height - 2
397400
assert_greater_than(batch_size, blocks_left)
398401
self.bump_mocktime(blocks_left)
399402
self.nodes[0].generate(blocks_left)
400403
self.sync_blocks()
401404

405+
softfork_info = get_bip9_details(self.nodes[0], 'v20')
406+
assert_equal(softfork_info['status'], 'started')
407+
assert 'activation_height' not in softfork_info
408+
409+
self.bump_mocktime(1)
410+
self.nodes[0].generate(1)
411+
self.sync_blocks()
412+
402413
softfork_info = get_bip9_details(self.nodes[0], 'v20')
403414
assert_equal(softfork_info['status'], 'locked_in')
415+
assert_equal(softfork_info['since'], expected_locked_in_height)
404416
assert 'activation_height' in softfork_info
405417
projected_activation_height = softfork_info['activation_height']
406418

0 commit comments

Comments
 (0)