Skip to content

Commit

Permalink
pytest: allow more time for test_waitblockheight !DEVELOPER.
Browse files Browse the repository at this point in the history
It actually timed out with the default 60 seconds, just before it
saw the block:

```
2022-06-07T02:16:05.2557049Z         bitcoind.generate_block(1)
2022-06-07T02:16:05.2557300Z         sync_blockheight(bitcoind, [node])
2022-06-07T02:16:05.2557594Z         fut1.result(5)
2022-06-07T02:16:05.2557912Z         assert not fut2.done()
2022-06-07T02:16:05.2558121Z     
2022-06-07T02:16:05.2558370Z         # Trigger two blocks.
2022-06-07T02:16:05.2558689Z         bitcoind.generate_block(1)
2022-06-07T02:16:05.2558941Z         sync_blockheight(bitcoind, [node])
2022-06-07T02:16:05.2559219Z >       fut2.result(5)
2022-06-07T02:16:05.2559350Z 
2022-06-07T02:16:05.2559508Z tests/test_misc.py:2138: 
...
2022-06-07T02:16:05.2586947Z         elif "error" in resp:
2022-06-07T02:16:05.2587398Z >           raise RpcError(method, payload, resp['error'])
2022-06-07T02:16:05.2588026Z E           pyln.client.lightning.RpcError: RPC call failed: method: waitblockheight, payload: {'blockheight': 103}, error: {'code': 2000, 'message': 'Timed out.'}
2022-06-07T02:16:05.2588325Z 
2022-06-07T02:16:05.2588563Z contrib/pyln-client/pyln/client/lightning.py:387: RpcError
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jun 27, 2022
1 parent b4820d6 commit fcff21f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,9 +2135,16 @@ def test_waitblockheight(node_factory, executor, bitcoind):
node.rpc.waitblockheight(blockheight - 1)
node.rpc.waitblockheight(blockheight)

# Developer mode polls bitcoind every second, so 60 seconds is plenty.
# But non-developer mode polls every 30 seconds, so try 120.
if DEVELOPER:
time = 60
else:
time = 120

# Should not succeed yet.
fut2 = executor.submit(node.rpc.waitblockheight, blockheight + 2)
fut1 = executor.submit(node.rpc.waitblockheight, blockheight + 1)
fut2 = executor.submit(node.rpc.waitblockheight, blockheight + 2, time)
fut1 = executor.submit(node.rpc.waitblockheight, blockheight + 1, time)
assert not fut1.done()
assert not fut2.done()

Expand Down

0 comments on commit fcff21f

Please sign in to comment.