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

Function init

plugins/recover.c:246–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246static const char *init(struct command *init_cmd,
247 const char *buf UNUSED,
248 const jsmntok_t *config UNUSED)
249{
250 plugin = init_cmd->plugin;
251 plugin_log(plugin, LOG_DBG, "Recover Plugin Initialised!");
252 recovery = false;
253 lost_state_timer = global_timer(plugin, time_from_sec(STARTUP_TIME),
254 do_check_lost_peer, NULL);
255 u32 num_peers;
256
257 /* Find number of peers */
258 rpc_scan(init_cmd, "getinfo",
259 take(json_out_obj(NULL, NULL, NULL)),
260 "{id:%,num_peers:%}",
261 JSON_SCAN(json_to_node_id, &local_id),
262 JSON_SCAN(json_to_u32, &num_peers));
263
264 global_gossmap = notleak_with_children(gossmap_load(NULL,
265 GOSSIP_STORE_FILENAME,
266 plugin_gossmap_logcb,
267 plugin));
268
269 if (!global_gossmap)
270 plugin_err(plugin, "Could not load gossmap %s: %s",
271 GOSSIP_STORE_FILENAME, strerror(errno));
272
273 plugin_log(plugin, LOG_DBG, "Gossmap loaded!");
274
275 already_has_peers = num_peers > 1 ? 1: 0;
276
277 return NULL;
278}
279
280
281int main(int argc, char *argv[])

Callers

nothing calls this directly

Calls 5

time_from_secFunction · 0.85
plugin_logFunction · 0.70
rpc_scanFunction · 0.70
json_out_objFunction · 0.70
plugin_errFunction · 0.70

Tested by

no test coverage detected