From af394244914e69a5b2f16e1f10ef412217f9714a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 21 Aug 2023 10:18:48 +0930 Subject: [PATCH] lightningd: don't restart subds unnecessarily on reconnect. During tests we can see that the subdaemon can be restarted unnecessarily if we're slow enough; we don't need to do so if it's still running. Reported-by: Matt Morehouse Signed-off-by: Rusty Russell --- lightningd/peer_control.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 7df4d5ee5..9455d3e0a 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1276,7 +1276,8 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa /* connect appropriate subds for all (active) channels! */ list_for_each(&peer->channels, channel, list) { - if (channel_active(channel)) { + /* FIXME: It can race by opening a channel before this! */ + if (channel_active(channel) && !channel->owner) { log_debug(channel->log, "Peer has reconnected, state %s: connecting subd", channel_state_name(channel));