From 7820dfdb3506cb6f109622e3d553d3ca59169d91 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 19 Jun 2023 12:14:44 +0930 Subject: [PATCH] lightningd: tell connectd to disconnect even if it's connecting now. We were seeing hangs in disconnect in tests/test_connection.py::test_feerate_stress, and looking at the logs it's because we're not actually telling connectd to disconnect. These days, we have a connect counter, so connectd knows to ignore it if we simply haven't read the message about it already disconnecting. Signed-off-by: Rusty Russell --- lightningd/peer_control.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index c08b2e325..33f6cdbdb 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -2318,11 +2318,9 @@ static struct command_result *json_disconnect(struct command *cmd, channel_state_name(channel)); } - /* If it's not already disconnecting, tell connectd to disconnect */ - if (peer->connected == PEER_CONNECTED) - subd_send_msg(peer->ld->connectd, - take(towire_connectd_discard_peer(NULL, &peer->id, - peer->connectd_counter))); + subd_send_msg(peer->ld->connectd, + take(towire_connectd_discard_peer(NULL, &peer->id, + peer->connectd_counter))); /* Connectd tells us when it's finally disconnected */ dc = tal(cmd, struct disconnect_command);