From d09d0112f454f5cc89c8d042d5c5c0bc5270f9e1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 20 Jun 2023 14:40:03 +0930 Subject: [PATCH] pytest: handle v fast disconnect during test_funding_external_wallet_corners() We get "disconnected during connection" if we haven't finished processing the connection when the peer sends error and hangs up. Signed-off-by: Rusty Russell --- tests/test_connection.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index f6d019ca9..4f66d027a 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1401,7 +1401,13 @@ def test_funding_external_wallet_corners(node_factory, bitcoind): assert len(l1.rpc.listpeers()['peers']) == 0 # on reconnect, channel should get destroyed - l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + # FIXME: if peer disconnects too fast, we get + # "disconnected during connection" + try: + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + except RpcError as err: + assert "disconnected during connection" in err.error + l1.daemon.wait_for_log('Unknown channel .* for WIRE_CHANNEL_REESTABLISH') wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 0) wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 0)