Skip to content

Commit

Permalink
pytest: fix flake in test_option_upfront_shutdown_script
Browse files Browse the repository at this point in the history
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 <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jul 4, 2022
1 parent 9d0e1d8 commit 36ef5f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 36ef5f4

Please sign in to comment.