From b1f393f355ed3a3ad11dd46b18c5b782db7497b2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 26 Jun 2022 14:04:01 +0930 Subject: [PATCH] pytest: fix race in test_multichan We can fail to use larger channel if it's not ready yet: ``` 2022-05-23T01:20:05.5325600Z # Check it used the larger channel! 2022-05-23T01:20:05.5326376Z > assert before[chan23a_idx]['to_us_msat'] == after[chan23a_idx]['to_us_msat'] 2022-05-23T01:20:05.5326961Z E assert 1000000000msat == 900000000msat 2022-05-23T01:20:05.5327240Z 2022-05-23T01:20:05.5327621Z tests/test_connection.py:3896: AssertionError ``` Signed-off-by: Rusty Russell --- tests/test_connection.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_connection.py b/tests/test_connection.py index 87ac9a9ba..ae125f045 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -3869,6 +3869,8 @@ def test_multichan(node_factory, executor, bitcoind): assert(len(only_one(l3.rpc.listpeers(l2.info['id'])['peers'])['channels']) == 2) bitcoind.generate_block(1, wait_for_mempool=1) + # Make sure new channel is also CHANNELD_NORMAL + wait_for(lambda: [c['state'] for c in only_one(l2.rpc.listpeers(l3.info['id'])['peers'])['channels']] == ["CHANNELD_NORMAL", "CHANNELD_NORMAL"]) # Dance around to get the *other* scid. wait_for(lambda: all(['short_channel_id' in c for c in l3.rpc.listpeers()['peers'][0]['channels']]))