From bc7ca34a38984d33fab437943531081097100ed6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 13 Aug 2018 16:33:05 +0930 Subject: [PATCH] pytest: fix race in test_closing_different_fees We got an index error, because status had only one field (onchaind not started yet). > wait_for(lambda: only_one(p.rpc.listpeers(l1.info['id'])['peers'][0]['channels'])['status'][1] == 'ONCHAIN:Tracking mutual close transaction') E IndexError: list index out of range1 Signed-off-by: Rusty Russell --- tests/test_closing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_closing.py b/tests/test_closing.py index 6c39a5416..9d37c147c 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -244,7 +244,8 @@ def test_closing_different_fees(node_factory, bitcoind, executor): bitcoind.generate_block(1) for p in peers: p.daemon.wait_for_log(' to ONCHAIN') - wait_for(lambda: only_one(p.rpc.listpeers(l1.info['id'])['peers'][0]['channels'])['status'][1] == 'ONCHAIN:Tracking mutual close transaction') + wait_for(lambda: 'ONCHAIN:Tracking mutual close transaction' in only_one(p.rpc.listpeers(l1.info['id'])['peers'][0]['channels'])['status']) + l1.daemon.wait_for_logs([' to ONCHAIN'] * num_peers)