From ae49545875d2d53c00a2999a888fccef749a0b30 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 4 Jul 2022 20:41:47 +0930 Subject: [PATCH] pytest: fix flake in test_option_upfront_shutdown_script Looking at the CI logs, it seems like it took over 5 seconds, so the unilateral close occurred instead of the expected rejection of the WIRE_SHUTDOWN reply. Make it bulletproof. Signed-off-by: Rusty Russell --- tests/test_closing.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_closing.py b/tests/test_closing.py index 2bd8165e4..c22143888 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -3214,11 +3214,14 @@ def test_option_upfront_shutdown_script(node_factory, bitcoind, executor): l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l1.fundchannel(l2, 1000000, False) - l2.rpc.close(l1.info['id'], unilateraltimeout=5) + fut = executor.submit(l2.rpc.close, l1.info['id']) # l2 will send warning unilaterally when it dislikes shutdown script. l1.daemon.wait_for_log(r'WARNING.*scriptpubkey .* is not as agreed upfront \(00143d43d226bcc27019ade52d7a3dc52a7ac1be28b8\)') + l2.rpc.close(l1.info['id'], unilateraltimeout=1) + fut.result(TIMEOUT) + bitcoind.generate_block(1, wait_for_mempool=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'])