gossipd: don't try to connect to ourselves if we need more peers.

Reported-by: JssDWt
Closes: https://github.com/ElementsProject/lightning/issues/8200
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-None: trivial
This commit is contained in:
Rusty Russell
2025-05-08 13:15:20 +09:30
committed by Alex Myers
parent 1521b92e41
commit 9a967d6770

View File

@@ -829,9 +829,11 @@ static struct node_id *get_random_node(const tal_t *ctx,
struct node_id id;
gossmap_node_get_id(gossmap, node, &id);
/* Make sure it *has* an announcement, and we're not
* already connected */
if (gossmap_node_get_announce(tmpctx, gossmap, node)
if (!node_id_eq(&id, &seeker->daemon->id)
&& gossmap_node_get_announce(tmpctx, gossmap, node)
&& !find_peer(seeker->daemon, &id)) {
return tal_dup(ctx, struct node_id, &id);
}