We're going to abuse MCF, and take the largest flow it gives and ram everything * through it. This is more effective if there's at least a *chance* that can handle * the full amount. * * It's far from perfect, but I have very little sympathy: if you want * to receive amounts reliably, enable MPP. */
| 314 | * to receive amounts reliably, enable MPP. |
| 315 | */ |
| 316 | static struct layer *remove_small_channel_layer(const tal_t *ctx, |
| 317 | struct askrene *askrene, |
| 318 | struct amount_msat min_amount, |
| 319 | struct gossmap_localmods *localmods) |
| 320 | { |
| 321 | /* We use the prefix auto. to avoid clashing */ |
| 322 | struct layer *layer = new_temp_layer(ctx, askrene, "auto.remove_small_channels"); |
| 323 | struct gossmap *gossmap = askrene->gossmap; |
| 324 | struct gossmap_chan *c; |
| 325 | |
| 326 | /* We apply this so we see any created channels */ |
| 327 | gossmap_apply_localmods(gossmap, localmods); |
| 328 | |
| 329 | for (c = gossmap_first_chan(gossmap); c; c = gossmap_next_chan(gossmap, c)) { |
| 330 | struct short_channel_id_dir scidd; |
| 331 | if (amount_msat_greater_eq(gossmap_chan_get_capacity(gossmap, c), |
| 332 | min_amount)) |
| 333 | continue; |
| 334 | |
| 335 | scidd.scid = gossmap_chan_scid(gossmap, c); |
| 336 | /* Layer will disable this in both directions */ |
| 337 | for (scidd.dir = 0; scidd.dir < 2; scidd.dir++) { |
| 338 | const bool enabled = false; |
| 339 | layer_add_update_channel(layer, &scidd, &enabled, |
| 340 | NULL, NULL, NULL, NULL, NULL); |
| 341 | } |
| 342 | } |
| 343 | gossmap_remove_localmods(gossmap, localmods); |
| 344 | |
| 345 | return layer; |
| 346 | } |
| 347 | |
| 348 | PRINTF_FMT(4, 5) |
| 349 | static const char *cmd_log(const tal_t *ctx, |
no test coverage detected