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... */
| 223 | * but we won't. */ |
| 224 | /* FIXME: We could cache this until gossmap/layer changes... */ |
| 225 | static struct layer *source_free_layer(const tal_t *ctx, |
| 226 | struct askrene *askrene, |
| 227 | const struct node_id *source, |
| 228 | struct gossmap_localmods *localmods) |
| 229 | { |
| 230 | /* We apply existing localmods so we see *all* channels */ |
| 231 | struct gossmap *gossmap = askrene->gossmap; |
| 232 | const struct gossmap_node *srcnode; |
| 233 | const struct amount_msat zero_base_fee = AMOUNT_MSAT(0); |
| 234 | const u16 zero_delay = 0; |
| 235 | const u32 zero_prop_fee = 0; |
| 236 | struct layer *layer = new_temp_layer(ctx, askrene, "auto.sourcefree"); |
| 237 | |
| 238 | /* We apply this so we see any created channels */ |
| 239 | gossmap_apply_localmods(gossmap, localmods); |
| 240 | |
| 241 | /* If we're not in map, we complain later */ |
| 242 | srcnode = gossmap_find_node(gossmap, source); |
| 243 | |
| 244 | for (size_t i = 0; srcnode && i < srcnode->num_chans; i++) { |
| 245 | struct short_channel_id_dir scidd; |
| 246 | const struct gossmap_chan *c; |
| 247 | |
| 248 | c = gossmap_nth_chan(gossmap, srcnode, i, &scidd.dir); |
| 249 | scidd.scid = gossmap_chan_scid(gossmap, c); |
| 250 | layer_add_update_channel(layer, &scidd, |
| 251 | NULL, NULL, NULL, |
| 252 | &zero_base_fee, &zero_prop_fee, |
| 253 | &zero_delay); |
| 254 | } |
| 255 | gossmap_remove_localmods(gossmap, localmods); |
| 256 | |
| 257 | return layer; |
| 258 | } |
| 259 | |
| 260 | /* We're going to abuse MCF, and take the largest flow it gives and ram everything |
| 261 | * through it. This is more effective if there's at least a *chance* that can handle |
no test coverage detected