diff --git a/daemon/peer.c b/daemon/peer.c index d9cefa5d1..4da4debbf 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -702,6 +702,28 @@ static bool open_theiranchor_pkt_in(struct peer *peer, const Pkt *pkt) return true; } +/* Dump all known channels and nodes to the peer. Used when a new + * connection was established. */ +static void sync_routing_table(struct lightningd_state *dstate, struct peer *peer) +{ + struct node *n; + struct node_map_iter it; + int i; + struct node_connection *nc; + for (n = node_map_first(dstate->rstate->nodes, &it); n; n = node_map_next(dstate->rstate->nodes, &it)) { + size_t num_edges = tal_count(n->out); + for (i = 0; i < num_edges; i++) { + nc = n->out[i]; + if (nc->channel_announcement) + queue_pkt_nested(peer, WIRE_CHANNEL_ANNOUNCEMENT, nc->channel_announcement); + if (nc->channel_update) + queue_pkt_nested(peer, WIRE_CHANNEL_UPDATE, nc->channel_update); + } + if (n->node_announcement && num_edges > 0) + queue_pkt_nested(peer, WIRE_NODE_ANNOUNCEMENT, n->node_announcement); + } +} + static bool open_wait_pkt_in(struct peer *peer, const Pkt *pkt) { Pkt *err; diff --git a/daemon/routing.c b/daemon/routing.c index c86f89fde..38f991b9c 100644 --- a/daemon/routing.c +++ b/daemon/routing.c @@ -554,26 +554,6 @@ static void json_add_route(struct command *cmd, command_success(cmd, null_response(cmd)); } -void sync_routing_table(struct lightningd_state *dstate, struct peer *peer) -{ - struct node *n; - struct node_map_iter it; - int i; - struct node_connection *nc; - for (n = node_map_first(dstate->rstate->nodes, &it); n; n = node_map_next(dstate->rstate->nodes, &it)) { - size_t num_edges = tal_count(n->out); - for (i = 0; i < num_edges; i++) { - nc = n->out[i]; - if (nc->channel_announcement) - queue_pkt_nested(peer, WIRE_CHANNEL_ANNOUNCEMENT, nc->channel_announcement); - if (nc->channel_update) - queue_pkt_nested(peer, WIRE_CHANNEL_UPDATE, nc->channel_update); - } - if (n->node_announcement && num_edges > 0) - queue_pkt_nested(peer, WIRE_NODE_ANNOUNCEMENT, n->node_announcement); - } -} - static const struct json_command dev_add_route_command = { "dev-add-route", json_add_route, diff --git a/daemon/routing.h b/daemon/routing.h index 2136502c0..74edd155e 100644 --- a/daemon/routing.h +++ b/daemon/routing.h @@ -149,8 +149,4 @@ struct node_map *empty_node_map(const tal_t *ctx); char *opt_add_route(const char *arg, struct lightningd_state *dstate); -/* Dump all known channels and nodes to the peer. Used when a new connection was established. */ -//FIXME(cdecker) Not used in the gossip subdaemon, remove once old daemon is retired -void sync_routing_table(struct lightningd_state *dstate, struct peer *peer); - #endif /* LIGHTNING_DAEMON_ROUTING_H */