From a2596989062b32dbc1cfbeeb05db20a2c2a612f9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 27 Jul 2022 19:32:04 +0930 Subject: [PATCH] pytest: test that we don't try to reconnect in AWAITING_UNILATERAL. We would just send an error, and it's annoying. Signed-off-by: Rusty Russell --- tests/test_connection.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_connection.py b/tests/test_connection.py index af0421142..ebfb00133 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -4136,3 +4136,20 @@ def test_mutual_reconnect_race(node_factory, executor, bitcoind): wait_for(lambda: only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['connected']) inv = l2.rpc.invoice(100000000, "invoice4", "invoice4") l1.rpc.pay(inv['bolt11']) + + +@pytest.mark.xfail(strict=True, reason="Still connects when AWAITING_UNILATERAL") +def test_no_reconnect_awating_unilateral(node_factory, bitcoind): + l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True}) + l2.stop() + + # Close immediately. + l1.rpc.close(l2.info['id'], 1) + + wait_for(lambda: only_one(only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels'])['state'] == 'AWAITING_UNILATERAL') + + # After switching to AWAITING_UNILATERAL it will *not* try to reconnect. + l1.daemon.wait_for_log("State changed from CHANNELD_SHUTTING_DOWN to AWAITING_UNILATERAL") + time.sleep(10) + + assert not l1.daemon.is_in_log('Will try reconnect', start=l1.daemon.logsearch_start)