MCPcopy Create free account
hub / github.com/ElementsProject/lightning / apply_layers

Function apply_layers

plugins/askrene/askrene.c:430–465  ·  view source on GitHub ↗

Gather layers, clear capacities where layers contains info */

Source from the content-addressed store, hash-verified

428
429/* Gather layers, clear capacities where layers contains info */
430static 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
467static struct command_result *reap_child(struct router_child *child)
468{

Callers 1

do_getroutesFunction · 0.85

Calls 4

find_layerFunction · 0.85
cmd_logFunction · 0.85
source_free_layerFunction · 0.85
add_layerFunction · 0.70

Tested by

no test coverage detected