Gather layers, clear capacities where layers contains info */
| 428 | |
| 429 | /* Gather layers, clear capacities where layers contains info */ |
| 430 | static const struct layer **apply_layers(const tal_t *ctx, |
| 431 | struct askrene *askrene, |
| 432 | struct command *cmd, |
| 433 | const struct node_id *source, |
| 434 | struct gossmap_localmods *localmods, |
| 435 | const char **layernames, |
| 436 | const struct layer *local_layer, |
| 437 | fp16_t *capacities) |
| 438 | { |
| 439 | const struct layer **layers = tal_arr(ctx, const struct layer *, 0); |
| 440 | /* Layers must exist, but might be special ones! */ |
| 441 | for (size_t i = 0; i < tal_count(layernames); i++) { |
| 442 | const struct layer *l = find_layer(askrene, layernames[i]); |
| 443 | if (!l) { |
| 444 | if (streq(layernames[i], "auto.localchans")) { |
| 445 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.localchans"); |
| 446 | l = local_layer; |
| 447 | } else if (streq(layernames[i], "auto.no_mpp_support")) { |
| 448 | /* deprecated */ |
| 449 | continue; |
| 450 | } else if (streq(layernames[i], "auto.include_fees")) { |
| 451 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.include_fees"); |
| 452 | /* This layer takes effect when converting flows |
| 453 | * into routes. */ |
| 454 | continue; |
| 455 | } else { |
| 456 | assert(streq(layernames[i], "auto.sourcefree")); |
| 457 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.sourcefree"); |
| 458 | l = source_free_layer(layernames, askrene, source, localmods); |
| 459 | } |
| 460 | } |
| 461 | add_layer(&layers, l, askrene->gossmap, localmods, capacities); |
| 462 | } |
| 463 | |
| 464 | return layers; |
| 465 | } |
| 466 | |
| 467 | static struct command_result *reap_child(struct router_child *child) |
| 468 | { |
no test coverage detected