pytest: fix race in test_bookkeeping_closing_subsat_htlcs

With the next change (which, as a side-effect, speeds up listpeers),
we seem to hit a race in this test.  The bookkeeper doesn't get to
process the final payment before the node is shutdown.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-01-12 11:55:58 +10:30
parent a2347c7452
commit 9ffaab7d22
1 changed files with 3 additions and 0 deletions

View File

@ -81,6 +81,9 @@ def test_bookkeeping_closing_subsat_htlcs(node_factory, bitcoind, chainparams):
l1.pay(l2, 222)
l1.pay(l2, 4000000)
# Make sure l2 bookkeeper processes event before we stop it!
wait_for(lambda: len([e for e in l2.rpc.bkpr_listaccountevents()['events'] if e['tag'] == 'invoice']) == 3)
l2.stop()
l1.rpc.close(l2.info['id'], 1)
bitcoind.generate_block(5, wait_for_mempool=1)