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

Function catch_node_announcement

gossipd/routing.c:735–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735static void catch_node_announcement(const tal_t *ctx,
736 struct routing_state *rstate,
737 struct node_id *nodeid)
738{
739 struct pending_node_announce *pna;
740 struct node *node;
741
742 /* No need if we already know about the node. We might, however, only
743 * know about it because it's a peer (maybe with private or
744 * not-yet-announced channels), so check for that too. */
745 node = get_node(rstate, nodeid);
746 if (node && node_has_public_channels(node))
747 return;
748
749 /* We can have multiple channels announced at same time for nodes;
750 * but we can only have one of these in the map. */
751 pna = pending_node_map_get(rstate->pending_node_map, nodeid);
752 if (!pna) {
753 pna = tal(rstate, struct pending_node_announce);
754 pna->rstate = rstate;
755 pna->nodeid = *nodeid;
756 pna->node_announcement = NULL;
757 pna->timestamp = 0;
758 pna->index = 0;
759 pna->refcount = 0;
760 pna->peer_softref = NULL;
761 pending_node_map_add(rstate->pending_node_map, pna);
762 }
763 pna->refcount++;
764 tal_add_destructor2(ctx, del_pending_node_announcement, pna);
765}
766
767static void process_pending_node_announcement(struct routing_state *rstate,
768 struct node_id *nodeid)

Callers 2

Calls 2

node_has_public_channelsFunction · 0.85
get_nodeFunction · 0.70

Tested by

no test coverage detected