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

Function init

plugins/askrene/askrene.c:1512–1541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1510};
1511
1512static const char *init(struct command *init_cmd,
1513 const char *buf UNUSED, const jsmntok_t *config UNUSED)
1514{
1515 struct plugin *plugin = init_cmd->plugin;
1516 struct askrene *askrene = get_askrene(plugin);
1517
1518 askrene->plugin = plugin;
1519 askrene->layers = new_layer_name_hash(askrene);
1520 list_head_init(&askrene->children);
1521 list_head_init(&askrene->waiters);
1522 askrene->num_live_requests = 0;
1523 askrene->reserved = new_reserve_htable(askrene);
1524 askrene->gossmap = gossmap_load(askrene, GOSSIP_STORE_FILENAME,
1525 plugin_gossmap_logcb, plugin);
1526
1527 if (!askrene->gossmap)
1528 plugin_err(plugin, "Could not load gossmap %s: %s",
1529 GOSSIP_STORE_FILENAME, strerror(errno));
1530 askrene->capacities = get_capacities(askrene, askrene->plugin, askrene->gossmap);
1531 rpc_scan(init_cmd, "getinfo", take(json_out_obj(NULL, NULL, NULL)),
1532 "{id:%}", JSON_SCAN(json_to_node_id, &askrene->my_id));
1533
1534 plugin_set_data(plugin, askrene);
1535
1536 load_layers(askrene, init_cmd);
1537
1538 /* Layer needs its own command to write to the datastore */
1539 askrene->layer_cmd = aux_command(init_cmd);
1540 return NULL;
1541}
1542
1543int main(int argc, char *argv[])
1544{

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