pytest: fix timeout in test_channel_lease_unilat_closes

Sometimes syncing 4032 blocks can take too long:

```
        # This can timeout, so do it in easy stages.
        for i in range(16):
            bitcoind.generate_block(4032 // 16)
>       sync_blockheight(bitcoind, [l2, l3])

tests/test_closing.py:996: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
contrib/pyln-testing/pyln/testing/utils.py:135: in sync_blockheight
    wait_for(lambda: n.rpc.getinfo()['blockheight'] == height)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function sync_blockheight.<locals>.<lambda> at 0x7ffb00227670>
timeout = 180

    def wait_for(success, timeout=TIMEOUT):
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}".format(success))
E               ValueError: Timeout while waiting for <function sync_blockheight.<locals>.<lambda> at 0x7ffb00227670>
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-21 14:52:33 +09:30
parent e91f8ddb51
commit 2e28226e18

View File

@@ -993,7 +993,7 @@ def test_channel_lease_unilat_closes(node_factory, bitcoind):
# This can timeout, so do it in easy stages.
for i in range(16):
bitcoind.generate_block(4032 // 16)
sync_blockheight(bitcoind, [l2, l3])
sync_blockheight(bitcoind, [l2, l3])
l2.rpc.withdraw(l2.rpc.newaddr()['bech32'], "all", utxos=[utxo1])