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

Function populate_node_map

tests/plugins/channeld_fakenet.c:286–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286static void populate_node_map(const struct gossmap *gossmap,
287 struct node_map *node_map)
288{
289 for (size_t i = 0; i < gossmap_max_node_idx(gossmap); i++) {
290 struct node *n = tal(node_map, struct node);
291 struct pubkey pubkey;
292
293 /* gossmap-compress uses the node index (size_t, native endian), then all ones */
294 memset(&n->p, 1, sizeof(n->p));
295 memcpy(&n->p, &i, sizeof(i));
296 n->name = tal_fmt(n, "node#%zu", i);
297
298 pubkey_from_privkey(&n->p, &pubkey);
299 node_id_from_pubkey(&n->id, &pubkey);
300 node_map_add(node_map, n);
301 }
302}
303
304/* Sets current_node, *next_onion_packet, *shared_secret and *me, and decodes */
305static struct onion_payload *decode_onion(const tal_t *ctx,

Callers 1

mainFunction · 0.85

Calls 3

gossmap_max_node_idxFunction · 0.85
pubkey_from_privkeyFunction · 0.85
node_id_from_pubkeyFunction · 0.85

Tested by

no test coverage detected