Turns stale_scid_map into two arrays, and removes from map */
| 373 | |
| 374 | /* Turns stale_scid_map into two arrays, and removes from map */ |
| 375 | static struct short_channel_id *stale_scids_remove(const tal_t *ctx, |
| 376 | struct seeker *seeker, |
| 377 | u8 **query_flags) |
| 378 | { |
| 379 | struct short_channel_id *scids; |
| 380 | const u8 *qf; |
| 381 | /* We can fit 7000 comfortably (8 byte scid, 1 byte flag). */ |
| 382 | size_t i, max = 7000; |
| 383 | u64 scid; |
| 384 | |
| 385 | scids = tal_arr(ctx, struct short_channel_id, max); |
| 386 | *query_flags = tal_arr(ctx, u8, max); |
| 387 | |
| 388 | i = 0; |
| 389 | while ((qf = uintmap_first(&seeker->stale_scids, &scid)) != NULL) { |
| 390 | scids[i].u64 = scid; |
| 391 | (*query_flags)[i] = *qf; |
| 392 | uintmap_del(&seeker->stale_scids, scid); |
| 393 | tal_free(qf); |
| 394 | i++; |
| 395 | if (i == max) |
| 396 | break; |
| 397 | } |
| 398 | tal_resize(&scids, i); |
| 399 | tal_resize(query_flags, i); |
| 400 | return scids; |
| 401 | } |
| 402 | |
| 403 | static bool seek_any_stale_scids(struct seeker *seeker) |
| 404 | { |
no test coverage detected