From 9758b05bd0135a51bbf943d2ecf8b76ba1ced697 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 19 Dec 2024 11:23:35 +1030 Subject: [PATCH] pytest: fix flake in test_penalty_htlc_tx_fulfill Make sure balancing payment is fully cleared before trying to get a routeL ``` def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams, anchors): # now we send one 'sticky' htlc: l4->l1 amt = 10**8 // 2 sticky_inv = l1.rpc.invoice(amt, '2', 'sticky') > route = l4.rpc.getroute(l1.info['id'], amt, 1)['route'] tests/test_closing.py:1232: > raise RpcError(method, payload, resp['error']) E pyln.client.lightning.RpcError: RPC call failed: method: getroute, payload: {'id': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'amount_msat': 50000000, 'riskfactor': 1, 'cltv': 9}, error: {'code': 205, 'message': 'Could not find a route'} ``` --- tests/test_closing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_closing.py b/tests/test_closing.py index 047d9e420f0f..26f1148e38a0 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -1221,10 +1221,12 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams, anchors): inv = l2.rpc.invoice(10**9 // 2, '1', 'balancer') l1.rpc.pay(inv['bolt11']) l1.rpc.waitsendpay(inv['payment_hash']) + wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['htlcs'] == []) inv = l4.rpc.invoice(10**9 // 2, '1', 'balancer') l2.rpc.pay(inv['bolt11']) l2.rpc.waitsendpay(inv['payment_hash']) + wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['htlcs'] == []) # now we send one 'sticky' htlc: l4->l1 amt = 10**8 // 2