From 28b31c19dd67ad9709c9eee649298dbe08f0a8dd Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 5 Feb 2023 14:36:21 +1030 Subject: [PATCH] pytest: fix flake in test_bolt11_null_after_pay It's possible that l2 hasn't completely processed the connection yet: ``` # create l2->l1 channel. l2.fundwallet(amount_sat * 5) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) > l2.rpc.fundchannel(l1.info['id'], amount_sat * 3) tests/test_pay.py:3974: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ contrib/pyln-client/pyln/client/lightning.py:833: in fundchannel return self.call("fundchannel", payload) contrib/pyln-testing/pyln/testing/utils.py:706: in call res = LightningRpc.call(self, method, payload, cmdprefix, filter) ... E pyln.client.lightning.RpcError: RPC call failed: method: fundchannel, payload: {'id': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'amount': 3000000, 'announce': True}, error: {'code': 400, 'message': 'Unable to connect, no address known for peer', 'data': {'id': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'method': 'connect'}} contrib/pyln-client/pyln/client/lightning.py:422: RpcError ``` Signed-off-by: Rusty Russell --- tests/test_pay.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_pay.py b/tests/test_pay.py index 4543821cf..1db4d796a 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -3971,6 +3971,8 @@ def test_bolt11_null_after_pay(node_factory, bitcoind): # create l2->l1 channel. l2.fundwallet(amount_sat * 5) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + # Make sure l2 considers it fully connected too! + wait_for(lambda: l2.rpc.listpeers(l1.info['id']) != {'peers': []}) l2.rpc.fundchannel(l1.info['id'], amount_sat * 3) # Let the channel confirm.