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

Function init

plugins/askrene/askrene.c:1581–1610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1579};
1580
1581static const char *init(struct command *init_cmd,
1582 const char *buf UNUSED, const jsmntok_t *config UNUSED)
1583{
1584 struct plugin *plugin = init_cmd->plugin;
1585 struct askrene *askrene = get_askrene(plugin);
1586
1587 askrene->plugin = plugin;
1588 askrene->layers = new_layer_name_hash(askrene);
1589 list_head_init(&askrene->children);
1590 list_head_init(&askrene->waiters);
1591 askrene->num_live_requests = 0;
1592 askrene->reserved = new_reserve_htable(askrene);
1593 askrene->gossmap = gossmap_load(askrene, GOSSIP_STORE_FILENAME,
1594 plugin_gossmap_logcb, plugin);
1595
1596 if (!askrene->gossmap)
1597 plugin_err(plugin, "Could not load gossmap %s: %s",
1598 GOSSIP_STORE_FILENAME, strerror(errno));
1599 askrene->capacities = get_capacities(askrene, askrene->plugin, askrene->gossmap);
1600 rpc_scan(init_cmd, "getinfo", take(json_out_obj(NULL, NULL, NULL)),
1601 "{id:%}", JSON_SCAN(json_to_node_id, &askrene->my_id));
1602
1603 plugin_set_data(plugin, askrene);
1604
1605 load_layers(askrene, init_cmd);
1606
1607 /* Layer needs its own command to write to the datastore */
1608 askrene->layer_cmd = aux_command(init_cmd);
1609 return NULL;
1610}
1611
1612int main(int argc, char *argv[])
1613{

Callers

nothing calls this directly

Calls 11

get_askreneFunction · 0.85
new_layer_name_hashFunction · 0.85
list_head_initFunction · 0.85
new_reserve_htableFunction · 0.85
get_capacitiesFunction · 0.85
plugin_set_dataFunction · 0.85
load_layersFunction · 0.85
plugin_errFunction · 0.50
rpc_scanFunction · 0.50
json_out_objFunction · 0.50
aux_commandFunction · 0.50

Tested by

no test coverage detected