Browse Source

tests: fix flake in test_txprepare_restart

Detection of reserved outputs is async, going via bitcoind.  Wait for them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
paymod-02
Rusty Russell 5 years ago
committed by ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent
commit
dd4a1a3510
  1. 7
      tests/test_wallet.py

7
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. # 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) wait_for(lambda: [o['status'] for o in l1.rpc.listfunds()['outputs']] == ['confirmed'] * 10)
# It should have logged this for each output. # It should have logged this for each output (any order)
for i in decode['vin']: template = r'wallet: reserved output {}/{} reset to available'
assert l1.daemon.is_in_log('wallet: reserved output {}/{} reset to available'.format(i['txid'], i['vout'])) lines = [template.format(i['txid'], i['vout']) for i in decode['vin']]
l1.daemon.wait_for_logs(lines)
prep = l1.rpc.txprepare([{addr: 'all'}]) prep = l1.rpc.txprepare([{addr: 'all'}])
decode = bitcoind.rpc.decoderawtransaction(prep['unsigned_tx']) decode = bitcoind.rpc.decoderawtransaction(prep['unsigned_tx'])

Loading…
Cancel
Save