From dd4a1a3510b9a689cad7974e61fa8e94c013cb4c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 30 Jun 2020 20:21:56 +0930 Subject: [PATCH] tests: fix flake in test_txprepare_restart Detection of reserved outputs is async, going via bitcoind. Wait for them. Signed-off-by: Rusty Russell --- tests/test_wallet.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index ab1640040..947d46700 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -801,9 +801,10 @@ def test_txprepare_restart(node_factory, bitcoind, chainparams): # It goes backwards in blockchain just in case there was a reorg. Wait. wait_for(lambda: [o['status'] for o in l1.rpc.listfunds()['outputs']] == ['confirmed'] * 10) - # It should have logged this for each output. - for i in decode['vin']: - assert l1.daemon.is_in_log('wallet: reserved output {}/{} reset to available'.format(i['txid'], i['vout'])) + # It should have logged this for each output (any order) + template = r'wallet: reserved output {}/{} reset to available' + lines = [template.format(i['txid'], i['vout']) for i in decode['vin']] + l1.daemon.wait_for_logs(lines) prep = l1.rpc.txprepare([{addr: 'all'}]) decode = bitcoind.rpc.decoderawtransaction(prep['unsigned_tx'])