MCPcopy Create free account
hub / github.com/ElementsProject/lightning / do_check_gossip

Function do_check_gossip

plugins/recover.c:111–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110
111static struct command_result *do_check_gossip(struct command *cmd, void *unused)
112{
113 find_exes_timer = NULL;
114
115 gossmap_refresh(global_gossmap);
116
117 plugin_log(plugin, LOG_DBG, "Finding our node in gossip");
118
119 struct gossmap_node *n = gossmap_find_node(global_gossmap, &local_id);
120
121 if (n) {
122 for (size_t i = 0; i < n->num_chans; i++) {
123 int half;
124 struct node_id peer_id;
125 struct gossmap_chan *c = gossmap_nth_chan(global_gossmap, n, i, &half);
126 struct gossmap_node *neighbour = gossmap_nth_node(global_gossmap, c, !half);
127
128 gossmap_node_get_id(global_gossmap, neighbour, &peer_id);
129
130 struct out_req *req;
131 req = jsonrpc_request_start(cmd,
132 "connect",
133 connect_success,
134 connect_fail,
135 NULL);
136
137 json_add_node_id(req->js, "id", &peer_id);
138
139 plugin_log(plugin, LOG_DBG, "Connecting to: %s",
140 fmt_node_id(tmpctx, &peer_id));
141 send_outreq(req);
142
143 }
144
145 peer_storage_timer =
146 global_timer(plugin,
147 time_from_sec(CHECK_STORAGE_INTERVAL),
148 do_find_peer_storage, NULL);
149 return timer_complete(cmd);
150 }
151
152 find_exes_timer = global_timer(
153 plugin, time_from_sec(CHECK_PEER_INTERVAL), do_check_gossip, NULL);
154 return timer_complete(cmd);
155}
156
157static void entering_recovery_mode(struct command *cmd)
158{

Callers

nothing calls this directly

Calls 11

gossmap_refreshFunction · 0.85
gossmap_find_nodeFunction · 0.85
gossmap_nth_chanFunction · 0.85
gossmap_nth_nodeFunction · 0.85
gossmap_node_get_idFunction · 0.85
json_add_node_idFunction · 0.85
fmt_node_idFunction · 0.85
time_from_secFunction · 0.85
timer_completeFunction · 0.85
plugin_logFunction · 0.70
send_outreqFunction · 0.70

Tested by

no test coverage detected