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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-01-25 06:27:52 +10:30
parent 1087f9aadd
commit a8bed542f7
1 changed files with 6 additions and 5 deletions

View File

@ -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);