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

Function unknown_scids_remove

gossipd/seeker.c:292–311  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

290
291/* Turn unknown_scids map into a flat array, removes from map. */
292static struct short_channel_id *unknown_scids_remove(const tal_t *ctx,
293 struct seeker *seeker)
294{
295 struct short_channel_id *scids;
296 /* Marshal into an array: we can fit 8000 comfortably. */
297 size_t i, max = 8000;
298 u64 scid;
299
300 scids = tal_arr(ctx, struct short_channel_id, max);
301 i = 0;
302 while (uintmap_first(&seeker->unknown_scids, &scid)) {
303 scids[i].u64 = scid;
304 (void)uintmap_del(&seeker->unknown_scids, scid);
305 seeker->num_unknown_scids--;
306 if (++i == max)
307 break;
308 }
309 tal_resize(&scids, i);
310 return scids;
311}
312
313/* We have selected this peer to stream us startup gossip */
314static 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