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

Function unknown_scids_remove

gossipd/seeker.c:249–267  ·  view source on GitHub ↗

Turn unknown_scids map into a flat array, removes from map. */

Source from the content-addressed store, hash-verified

247
248/* Turn unknown_scids map into a flat array, removes from map. */
249static struct short_channel_id *unknown_scids_remove(const tal_t *ctx,
250 struct seeker *seeker)
251{
252 struct short_channel_id *scids;
253 /* Marshal into an array: we can fit 8000 comfortably. */
254 size_t i, max = 8000;
255 u64 scid;
256
257 scids = tal_arr(ctx, struct short_channel_id, max);
258 i = 0;
259 while (uintmap_first(&seeker->unknown_scids, &scid)) {
260 scids[i].u64 = scid;
261 (void)uintmap_del(&seeker->unknown_scids, scid);
262 if (++i == max)
263 break;
264 }
265 tal_resize(&scids, i);
266 return scids;
267}
268
269/* We have selected this peer to stream us startup gossip */
270static void peer_gossip_startup(struct seeker *seeker, struct peer *peer)

Callers 1

seek_any_unknown_scidsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected