Gather layers, clear capacities where layers contains info */
| 378 | |
| 379 | /* Gather layers, clear capacities where layers contains info */ |
| 380 | static const struct layer **apply_layers(const tal_t *ctx, |
| 381 | struct askrene *askrene, |
| 382 | struct command *cmd, |
| 383 | const struct node_id *source, |
| 384 | struct gossmap_localmods *localmods, |
| 385 | const char **layernames, |
| 386 | const struct layer *local_layer, |
| 387 | fp16_t *capacities) |
| 388 | { |
| 389 | const struct layer **layers = tal_arr(ctx, const struct layer *, 0); |
| 390 | /* Layers must exist, but might be special ones! */ |
| 391 | for (size_t i = 0; i < tal_count(layernames); i++) { |
| 392 | const struct layer *l = find_layer(askrene, layernames[i]); |
| 393 | if (!l) { |
| 394 | if (streq(layernames[i], "auto.localchans")) { |
| 395 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.localchans"); |
| 396 | l = local_layer; |
| 397 | } else if (streq(layernames[i], "auto.no_mpp_support")) { |
| 398 | /* deprecated */ |
| 399 | continue; |
| 400 | } else if (streq(layernames[i], "auto.include_fees")) { |
| 401 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.include_fees"); |
| 402 | /* This layer takes effect when converting flows |
| 403 | * into routes. */ |
| 404 | continue; |
| 405 | } else { |
| 406 | assert(streq(layernames[i], "auto.sourcefree")); |
| 407 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.sourcefree"); |
| 408 | l = source_free_layer(layernames, askrene, source, localmods); |
| 409 | } |
| 410 | } |
| 411 | add_layer(&layers, l, askrene->gossmap, localmods, capacities); |
| 412 | } |
| 413 | |
| 414 | return layers; |
| 415 | } |
| 416 | |
| 417 | static struct command_result *reap_child(struct router_child *child) |
| 418 | { |
no test coverage detected