From a8bed542f76987ef4384a996a7e7e042de482c17 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 25 Jan 2022 06:27:52 +1030 Subject: [PATCH] lightningd: start gossipd after channels are loaded. This is in preparation for gossipd feeding us the latest channel_updates, rather than having lightningd and channeld query gossipd when it wants to send an onion error with an update included. This means gossipd will start telling us the updates, so we need the channels loaded first. Signed-off-by: Rusty Russell --- lightningd/lightningd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index a73017835..06da23897 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -1027,11 +1027,6 @@ int main(int argc, char *argv[]) * socket pair, and gives us the other */ connectd_gossipd_fd = connectd_init(ld); - /*~ The gossip daemon looks after the routing gossip; - * channel_announcement, channel_update, node_announcement and gossip - * queries. */ - gossip_init(ld, connectd_gossipd_fd); - /*~ We do every database operation within a transaction; usually this * is covered by the infrastructure (eg. opening a transaction before * handling a message or expiring a timer), but for startup we do this @@ -1078,6 +1073,12 @@ int main(int argc, char *argv[]) unconnected_htlcs_in = load_channels_from_wallet(ld); db_commit_transaction(ld->wallet->db); + /*~ The gossip daemon looks after the routing gossip; + * channel_announcement, channel_update, node_announcement and gossip + * queries. It also hands us the latest channel_updates for our + * channels. */ + gossip_init(ld, connectd_gossipd_fd); + /*~ Create RPC socket: now lightning-cli can send us JSON RPC commands * over a UNIX domain socket specified by `ld->rpc_filename`. */ jsonrpc_listen(ld->jsonrpc, ld);