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

Function payment_get_excluded_channels

plugins/libplugin-pay.c:583–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583static const struct short_channel_id_dir *
584payment_get_excluded_channels(const tal_t *ctx, struct payment *p)
585{
586 struct payment *root = payment_root(p);
587 struct channel_hint *hint;
588 struct short_channel_id_dir *res =
589 tal_arr(ctx, struct short_channel_id_dir, 0);
590 for (size_t i = 0; i < tal_count(root->channel_hints); i++) {
591 hint = &root->channel_hints[i];
592
593 if (!hint->enabled)
594 tal_arr_expand(&res, hint->scid);
595
596 else if (amount_msat_greater(p->amount,
597 hint->estimated_capacity))
598 tal_arr_expand(&res, hint->scid);
599
600 else if (hint->local && hint->htlc_budget == 0)
601 /* If we cannot add any HTLCs to the channel we
602 * shouldn't look for a route through that channel */
603 tal_arr_expand(&res, hint->scid);
604 }
605 return res;
606}
607
608static const struct node_id *payment_get_excluded_nodes(const tal_t *ctx,
609 struct payment *p)

Callers 1

routehint_excludedFunction · 0.85

Calls 2

payment_rootFunction · 0.85
amount_msat_greaterFunction · 0.85

Tested by

no test coverage detected