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

Function apply_layers

plugins/askrene/askrene.c:380–415  ·  view source on GitHub ↗

Gather layers, clear capacities where layers contains info */

Source from the content-addressed store, hash-verified

378
379/* Gather layers, clear capacities where layers contains info */
380static 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
417static struct command_result *reap_child(struct router_child *child)
418{

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