From 4c8d656f77da99685f61a9f6efea6c408948a95d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 9 Dec 2025 12:54:12 +1030 Subject: [PATCH] gossipd: don't need hsm fd any more. gossipd no longer makes gossip messages, and hasn't since v24.02, so it doesn't actually need to talk to the hsm daemon. Also, various comments were out of date, so fix those too. Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 20 +++++++++----------- gossipd/gossipd.h | 7 ++----- lightningd/gossip_control.c | 5 +---- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 15bd4a46f..e6730d187 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -1,11 +1,12 @@ /*~ Welcome to the gossip daemon: keeper of maps! * - * This is the last "global" daemon; it has three purposes. + * This is the last "global" daemon; it has one main purpose: to + * maintain the append-only gossip_store file for other daemons and + * plugins to read the global network map. * - * 1. To determine routes for payments when lightningd asks. - * 2. The second purpose is to receive gossip from peers (via their - * per-peer daemons) and send it out to them. - * 3. Talk to `connectd` to to answer address queries for nodes. + * To do this, it gets gossip messages forwarded from connectd, makes + * gossip queries to peers, and can ask connect out to random peers to + * get more gossip. * * The gossip protocol itself is fairly simple, but has some twists which * add complexity to this daemon. @@ -14,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -591,9 +591,6 @@ int main(int argc, char *argv[]) daemon->deferred_txouts = tal_arr(daemon, struct short_channel_id, 0); daemon->current_blockheight = 0; /* i.e. unknown */ - /* Tell the ecdh() function how to talk to hsmd */ - ecdh_hsmd_setup(HSM_FD, status_failed); - /* Note the use of time_mono() here. That's a monotonic clock, which * is really useful: it can only be used to measure relative events * (there's no correspondence to time-since-Ken-grew-a-beard or @@ -620,8 +617,9 @@ int main(int argc, char *argv[]) } } -/*~ Note that the actual routing stuff is in routing.c; you might want to - * check that out later. +/*~ Note that the production of the gossip_store file is in gossmap_manage.c + * and gossip_store.c, and the (highly optimized!) read side is in + * common/gossmap.c; you might want to check those out later. * * But that's the last of the global daemons. We now move on to the first of * the per-peer daemons: openingd/openingd.c. diff --git a/gossipd/gossipd.h b/gossipd/gossipd.h index d558f58f3..93d793738 100644 --- a/gossipd/gossipd.h +++ b/gossipd/gossipd.h @@ -8,11 +8,8 @@ #include #include -/* We talk to `hsmd` to sign our gossip messages with the node key */ -#define HSM_FD 3 -/* connectd asks us for help finding nodes, and gossip fds for new peers */ -#define CONNECTD_FD 4 -#define CONNECTD2_FD 5 +/* connectd forwards gossip messages to us. */ +#define CONNECTD_FD 3 struct chan; struct peer; diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 7ecf0a531..a43d967c7 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -302,14 +302,11 @@ static void gossipd_init_done(struct subd *gossipd, void gossip_init(struct lightningd *ld, int connectd_fd) { u8 *msg; - int hsmfd; void *ret; - hsmfd = hsm_get_global_fd(ld, HSM_PERM_ECDH|HSM_PERM_SIGN_GOSSIP); - ld->gossip = new_global_subd(ld, "lightning_gossipd", gossipd_wire_name, gossip_msg, - take(&hsmfd), take(&connectd_fd), NULL); + take(&connectd_fd), NULL); if (!ld->gossip) err(1, "Could not subdaemon gossip");