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

Function enqueue_nannounce

gossipd/gossmap_manage.c:172–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172static void enqueue_nannounce(struct pending_nannounce ***queue,
173 const struct node_id *node_id,
174 u32 timestamp,
175 const u8 *nannounce TAKES,
176 const struct node_id *source_peer TAKES)
177{
178 struct pending_nannounce *pna;
179
180 if (tal_count(*queue) > PENDING_LIMIT) {
181 static bool warned = false;
182 status_unusual_once(&warned,
183 CI_UNEXPECTED
184 "node_announcements being flooded by %s: dropping some",
185 source_peer
186 ? fmt_node_id(tmpctx, source_peer)
187 : "unknown");
188 tal_free_if_taken(nannounce);
189 tal_free_if_taken(source_peer);
190 return;
191 }
192
193 pna = tal(*queue, struct pending_nannounce);
194
195 pna->node_id = *node_id;
196 pna->timestamp = timestamp;
197 pna->nannounce = tal_dup_talarr(pna, u8, nannounce);
198 pna->source_peer = tal_dup_or_null(pna, struct node_id, source_peer);
199
200 tal_arr_expand(queue, pna);
201}
202
203/* Helpers to keep counters in sync with maps! */
204static void map_init(struct cannounce_map *map, const char *name)

Callers 1

Calls 2

fmt_node_idFunction · 0.85
tal_free_if_takenFunction · 0.85

Tested by

no test coverage detected