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

Function new_node

gossipd/routing.c:371–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371static struct node *new_node(struct routing_state *rstate,
372 const struct node_id *id)
373{
374 struct node *n;
375
376 assert(!get_node(rstate, id));
377
378 n = tal(rstate, struct node);
379 n->id = *id;
380 memset(n->chans.arr, 0, sizeof(n->chans.arr));
381 broadcastable_init(&n->bcast);
382 broadcastable_init(&n->rgraph);
383 n->tokens = TOKEN_MAX;
384 node_map_add(rstate->nodes, n);
385 tal_add_destructor2(n, destroy_node, rstate);
386
387 return n;
388}
389
390/* We've received a channel_announce for a channel attached to this node:
391 * otherwise it's in the map only because it's a peer, or us. */

Callers 1

new_chanFunction · 0.70

Calls 2

broadcastable_initFunction · 0.85
get_nodeFunction · 0.70

Tested by

no test coverage detected