Skip to content

Commit 1354512

Browse files
committed
pytest: fix flake in test_channel_lease_unilat_closes
``` 2026-01-30T05:55:13.6654636Z # Note that l3 has the whole lease delay (minus blocks already mined) 2026-01-30T05:55:13.6655396Z _, _, l3blocks = l3.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET', 2026-01-30T05:55:13.6656086Z 'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US') 2026-01-30T05:55:13.6656618Z > assert l3blocks == 4032 - 6 - 2 - 1 2026-01-30T05:55:13.6657033Z E assert 4025 == (((4032 - 6) - 2) - 1) ``` Turns out that 4342043 (tests: de-flake test that was failing on cltv expiry) added a line to mine two more blocks, but the hardcoded 110 was not changed to 112, so we weren't actually waiting correctly. Remove hardcoded numbers in favor of calculation, and do the same in test_channel_lease_post_expiry (which was correct, for now). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 63497b3 commit 1354512

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/test_closing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,8 @@ def test_channel_lease_post_expiry(node_factory, bitcoind, chainparams):
871871
bitcoind.generate_block(6)
872872
sync_blockheight(bitcoind, [l1, l2])
873873
# make sure we're at the right place for the csv lock
874-
l2.daemon.wait_for_log('Blockheight: SENT_ADD_ACK_COMMIT->RCVD_ADD_ACK_REVOCATION LOCAL now 115')
874+
height = bitcoind.rpc.getblockchaininfo()['blocks']
875+
l2.daemon.wait_for_log(f'Blockheight: SENT_ADD_ACK_COMMIT->RCVD_ADD_ACK_REVOCATION LOCAL now {height}')
875876

876877
# We need to give l1-l2 time to update their blockheights
877878
for i in range(0, 4000, 1000):
@@ -980,7 +981,8 @@ def test_channel_lease_unilat_closes(node_factory, bitcoind):
980981
bitcoind.generate_block(2)
981982
sync_blockheight(bitcoind, [l1, l2, l3])
982983
# make sure we're at the right place for the csv lock
983-
l2.daemon.wait_for_log('Blockheight: SENT_ADD_ACK_COMMIT->RCVD_ADD_ACK_REVOCATION LOCAL now 110')
984+
height = bitcoind.rpc.getblockchaininfo()['blocks']
985+
l2.daemon.wait_for_log(f'Blockheight: SENT_ADD_ACK_COMMIT->RCVD_ADD_ACK_REVOCATION LOCAL now {height}')
984986
l2.stop()
985987

986988
# unilateral close channels l1<->l2 & l3<->l2

0 commit comments

Comments
 (0)