If we're the payer, we don't add delay or fee to our own outgoing * channels. This wouldn't be right if we looped back through ourselves, * but we won't. */ FIXME: We could cache this until gossmap/layer changes... */
| 272 | * but we won't. */ |
| 273 | /* FIXME: We could cache this until gossmap/layer changes... */ |
| 274 | static struct layer *source_free_layer(const tal_t *ctx, |
| 275 | struct askrene *askrene, |
| 276 | const struct node_id *source, |
| 277 | struct gossmap_localmods *localmods) |
| 278 | { |
| 279 | /* We apply existing localmods so we see *all* channels */ |
| 280 | struct gossmap *gossmap = askrene->gossmap; |
| 281 | const struct gossmap_node *srcnode; |
| 282 | const struct amount_msat zero_base_fee = AMOUNT_MSAT(0); |
| 283 | const u16 zero_delay = 0; |
| 284 | const u32 zero_prop_fee = 0; |
| 285 | struct layer *layer = new_temp_layer(ctx, askrene, "auto.sourcefree"); |
| 286 | |
| 287 | /* We apply this so we see any created channels */ |
| 288 | gossmap_apply_localmods(gossmap, localmods); |
| 289 | |
| 290 | /* If we're not in map, we complain later */ |
| 291 | srcnode = gossmap_find_node(gossmap, source); |
| 292 | |
| 293 | for (size_t i = 0; srcnode && i < srcnode->num_chans; i++) { |
| 294 | struct short_channel_id_dir scidd; |
| 295 | const struct gossmap_chan *c; |
| 296 | |
| 297 | c = gossmap_nth_chan(gossmap, srcnode, i, &scidd.dir); |
| 298 | scidd.scid = gossmap_chan_scid(gossmap, c); |
| 299 | layer_add_update_channel(layer, &scidd, |
| 300 | NULL, NULL, NULL, |
| 301 | &zero_base_fee, &zero_prop_fee, |
| 302 | &zero_delay); |
| 303 | } |
| 304 | gossmap_remove_localmods(gossmap, localmods); |
| 305 | |
| 306 | return layer; |
| 307 | } |
| 308 | |
| 309 | /* We're going to abuse MCF, and take the largest flow it gives and ram everything |
| 310 | * through it. This is more effective if there's at least a *chance* that can handle |
no test coverage detected