Skip to content

Commit 576d003

Browse files
committed
pytest: fix flake in test_wumbo_channels
We need to wait for *l2* to see the channel in CHANNELD_NORMAL, otherwise the array here is empty: ``` chan = only_one([c for c in l1.rpc.listpeerchannels(l2.info['id'])['channels'] if c['state'] == 'CHANNELD_NORMAL']) amount = chan['funding']['local_funds_msat'] assert amount > Millisatoshi(str((1 << 24) - 1) + "sat") # We should know we can spend that much! spendable = chan['spendable_msat'] assert spendable > Millisatoshi(str((1 << 24) - 1) + "sat") # So should peer. > chan = only_one([c for c in l2.rpc.listpeerchannels(l1.info['id'])['channels'] if c['state'] == 'CHANNELD_NORMAL']) tests/test_connection.py:3552: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ arr = [] def only_one(arr): """Many JSON RPC calls return an array; often we only expect a single entry """ > assert len(arr) == 1 E AssertionError ```
1 parent e79a275 commit 576d003

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/test_connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,11 +3533,13 @@ def test_wumbo_channels(node_factory, bitcoind):
35333533
l1.rpc.close(l2.info['id'])
35343534
bitcoind.generate_block(1, wait_for_mempool=1)
35353535
wait_for(lambda: l1.channel_state(l2) == 'ONCHAIN')
3536+
wait_for(lambda: l2.channel_state(l1) == 'ONCHAIN')
35363537

35373538
l1.rpc.connect(l2.info['id'], 'localhost', port=l2.port)
35383539
l1.rpc.fundchannel(l2.info['id'], 'all')
35393540
bitcoind.generate_block(1, wait_for_mempool=1)
35403541
wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in l1.rpc.listpeerchannels(l2.info['id'])['channels']])
3542+
wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in l2.rpc.listpeerchannels(l1.info['id'])['channels']])
35413543

35423544
# Exact amount depends on fees, but it will be wumbo!
35433545
chan = only_one([c for c in l1.rpc.listpeerchannels(l2.info['id'])['channels'] if c['state'] == 'CHANNELD_NORMAL'])

0 commit comments

Comments
 (0)