From 125f14a8d5b0957c722466d8dafc6458c1df7c85 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 10 Aug 2019 19:54:21 +0930 Subject: [PATCH] pytest: fix flaky "peer reconnected" message in test_option_upfront_shutdown_script If l2 doesn't think we're onchain yet, it treats the new connection from l1 as a reconnection, triggering 'ValueError: 1 nodes had unexpected reconnections' Signed-off-by: Rusty Russell --- tests/test_closing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_closing.py b/tests/test_closing.py index 085e64a37..cfbc225b9 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -1519,6 +1519,7 @@ def test_option_upfront_shutdown_script(node_factory, bitcoind): wait_for(lambda: len(bitcoind.rpc.getrawmempool()) != 0) bitcoind.generate_block(1) wait_for(lambda: [c['state'] for c in only_one(l1.rpc.listpeers()['peers'])['channels']] == ['ONCHAIN']) + wait_for(lambda: [c['state'] for c in only_one(l2.rpc.listpeers()['peers'])['channels']] == ['ONCHAIN']) # Works when l2 closes channel, too. l1.rpc.connect(l2.info['id'], 'localhost', l2.port) @@ -1533,6 +1534,7 @@ def test_option_upfront_shutdown_script(node_factory, bitcoind): wait_for(lambda: len(bitcoind.rpc.getrawmempool()) != 0) bitcoind.generate_block(1) wait_for(lambda: [c['state'] for c in only_one(l1.rpc.listpeers()['peers'])['channels']] == ['ONCHAIN', 'ONCHAIN']) + wait_for(lambda: [c['state'] for c in only_one(l2.rpc.listpeers()['peers'])['channels']] == ['ONCHAIN', 'ONCHAIN']) # Figure out what address it will try to use. keyidx = int(l1.db_query("SELECT val FROM vars WHERE name='bip32_max_index';")[0]['val'])