From 35011337eb3ea4a5e5e2713037b97278905b7006 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 21 Jun 2023 09:17:11 +0930 Subject: [PATCH] pytest: fix unexpected reconnection check in test_setconfig() If we reconnect before the channel is completely closed, we might get a "reconnected" message, so mine a block after and make sure it's processed. ``` 2023-06-20T11:37:56.1302058Z if errors.has_errors(): 2023-06-20T11:37:56.1302648Z # Format a nice list of everything that went wrong and raise an exception 2023-06-20T11:37:56.1303781Z request.node.has_errors = True 2023-06-20T11:37:56.1304091Z > raise ValueError(str(errors)) 2023-06-20T11:37:56.1304370Z E ValueError: 2023-06-20T11:37:56.1304624Z E Node errors: 2023-06-20T11:37:56.1305042Z E - lightningd-2: had unexpected reconnections 2023-06-20T11:37:56.1305340Z E Global errors: ``` ... ``` 2023-06-20T11:37:56.1960525Z lightningd-2 2023-06-20T11:21:28.638Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#2: Peer has reconnected, state CLOSINGD_SIGEXCHANGE: connecting subd ``` --- tests/test_misc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index fb9569010..d5f2fcef6 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -3398,7 +3398,7 @@ def test_fast_shutdown(node_factory): break -def test_setconfig(node_factory): +def test_setconfig(node_factory, bitcoind): l1, l2 = node_factory.line_graph(2, fundchannel=False) configfile = os.path.join(l2.daemon.opts.get("lightning-dir"), TEST_NETWORK, 'config') @@ -3436,7 +3436,10 @@ def test_setconfig(node_factory): l1.fundchannel(l2, 400000) l1.fundchannel(l2, 10**6) - l1.rpc.close(l2.info['id']) + txid = l1.rpc.close(l2.info['id'])['txid'] + # Make sure we're completely closed! + bitcoind.generate_block(1, wait_for_mempool=txid) + sync_blockheight(bitcoind, [l1, l2]) # It's persistent! l2.restart()