From 6287f3e3b127021bc316156800531b139cdfad25 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 21 Jun 2023 11:46:19 +0930 Subject: [PATCH] pytest: test_pay flake fix. This is almost certainly because the HTLCs are not fully settled, so wait for that: ``` 2023-06-20T11:37:56.2332158Z assert apys_2[0]['our_start_balance_msat'] == Millisatoshi(0) 2023-06-20T11:37:56.2332443Z > assert apys_1[0]['routed_out_msat'] == apys_2[0]['routed_in_msat'] 2023-06-20T11:37:56.2332571Z E assert 1892216msat == 2810170msat 2023-06-20T11:37:56.2332580Z 2023-06-20T11:37:56.2332717Z tests/test_pay.py:81: AssertionError ``` Signed-off-by: Rusty Russell --- tests/test_misc.py | 2 +- tests/test_pay.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index d5f2fcef6..be2cd4a42 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -3437,7 +3437,7 @@ def test_setconfig(node_factory, bitcoind): l1.fundchannel(l2, 10**6) txid = l1.rpc.close(l2.info['id'])['txid'] - # Make sure we're completely closed! + # Make sure we're completely closed! bitcoind.generate_block(1, wait_for_mempool=txid) sync_blockheight(bitcoind, [l1, l2]) diff --git a/tests/test_pay.py b/tests/test_pay.py index 6159602cf..5a0ab89dc 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -71,6 +71,9 @@ def test_pay(node_factory): payments = l1.rpc.listsendpays(inv)['payments'] assert len(payments) == 1 and payments[0]['payment_preimage'] == preimage + # Make sure they're completely settled, so accounting correct. + wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['htlcs'] == []) + # Check channels apy summary view of channel activity apys_1 = l1.rpc.bkpr_channelsapy()['channels_apy'] apys_2 = l2.rpc.bkpr_channelsapy()['channels_apy']