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

Function init_map_structs

common/gossmap.c:712–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710 bool *changed);
711
712static void init_map_structs(struct gossmap *map)
713{
714 /* Since channel_announcement is ~430 bytes, and channel_update is 136,
715 * node_announcement is 144, and current topology has 35000 channels
716 * and 10000 nodes, let's assume each channel gets about 750 bytes.
717 *
718 * We halve this, since often some records are deleted. */
719 map->channels = tal(map, struct chanidx_htable);
720 chanidx_htable_init_sized(map->channels, map->map_size / 750 / 2);
721 map->nodes = tal(map, struct nodeidx_htable);
722 nodeidx_htable_init_sized(map->nodes, map->map_size / 2500 / 2);
723
724 map->num_chan_arr = map->map_size / 750 / 2 + 1;
725 map->chan_arr = tal_arr(map, struct gossmap_chan, map->num_chan_arr);
726 map->freed_chans = init_chan_arr(map->chan_arr, 0);
727 map->num_node_arr = map->map_size / 2500 / 2 + 1;
728 map->node_arr = tal_arr(map, struct gossmap_node, map->num_node_arr);
729 map->freed_nodes = init_node_arr(map->node_arr, 0);
730}
731
732static bool reopen_store(struct gossmap *map, u64 ended_off)
733{

Callers 2

reopen_storeFunction · 0.85
load_gossip_storeFunction · 0.85

Calls 2

init_chan_arrFunction · 0.85
init_node_arrFunction · 0.85

Tested by

no test coverage detected