Skip to content

Commit 2362d67

Browse files
committed
pytest: fix flake in tests/test_bookkeeper.py::test_bookkeeping_missed_chans_leases
``` FAILED tests/test_bookkeeper.py::test_bookkeeping_missed_chans_leases - AssertionError: assert [{'tag': 'channel_open', 'credit_msat': 506268000, 'debit_msat': 0}, {'tag': 'lease_fee', 'credit_msat': 0, 'debit_msat': 6268000}, {'tag': 'invoice', 'credit_msat': 0, 'debit_msat': 11000000}, {'tag': 'onchain_fee', 'credit_msat': 1314000, 'debit_msat': 0}] == [{'tag': 'channel_open', 'credit_msat': 506268000, 'debit_msat': 0}, {'tag': 'lease_fee', 'credit_msat': 0, 'debit_msat': 6268000}, {'tag': 'onchain_fee', 'credit_msat': 1314000, 'debit_msat': 0}, {'tag': 'invoice', 'credit_msat': 0, 'debit_msat': 11000000}] At index 2 diff: {'tag': 'invoice', 'credit_msat': 0, 'debit_msat': 11000000} != {'tag': 'onchain_fee', 'credit_msat': 1314000, 'debit_msat': 0} Full diff: [ { 'credit_msat': 506268000, 'debit_msat': 0, 'tag': 'channel_open', }, { 'credit_msat': 0, 'debit_msat': 6268000, 'tag': 'lease_fee', }, { + 'credit_msat': 0, + 'debit_msat': 11000000, + 'tag': 'invoice', + }, + { 'credit_msat': 1314000, 'debit_msat': 0, 'tag': 'onchain_fee', }, - { - 'credit_msat': 0, - 'debit_msat': 11000000, - 'tag': 'invoice', - }, ] ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 33ef903 commit 2362d67

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_bookkeeper.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,14 @@ def test_bookkeeping_missed_chans_leases(node_factory, bitcoind):
379379
l1.wait_local_channel_active(scid)
380380
channel_id = first_channel_id(l1, l2)
381381

382+
# Sigh. bookkeeper sorts events by timestamp. If the invoice event happens
383+
# too close, it can change the order, so sleep here.
384+
time.sleep(1)
385+
386+
# Send l2 funds via the channel
382387
l1.pay(l2, invoice_msat)
383-
l1.daemon.wait_for_log(r'coin movement:.*\'invoice\'')
388+
# Make sure they're completely settled, so accounting correct.
389+
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['htlcs'] == [])
384390

385391
# Now turn the bookkeeper on and restart
386392
l1.stop()

0 commit comments

Comments
 (0)