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

Function payment_route_check

plugins/libplugin-pay.c:649–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649static bool payment_route_check(const struct gossmap *gossmap,
650 const struct gossmap_chan *c,
651 int dir,
652 struct amount_msat amount,
653 struct payment *p)
654{
655 struct short_channel_id scid;
656 const struct channel_hint *hint;
657
658 if (dst_is_excluded(gossmap, c, dir, payment_root(p)->excluded_nodes))
659 return false;
660
661 if (dst_is_excluded(gossmap, c, dir, p->temp_exclusion))
662 return false;
663
664 scid = gossmap_chan_scid(gossmap, c);
665 hint = find_hint(payment_root(p)->channel_hints, &scid, dir);
666 if (!hint)
667 return true;
668
669 if (!hint->enabled)
670 return false;
671
672 if (amount_msat_greater_eq(amount, hint->estimated_capacity))
673 /* We exclude on equality because we've set the
674 * estimate to the smallest failed attempt. */
675 return false;
676
677 if (hint->local && hint->htlc_budget == 0)
678 /* If we cannot add any HTLCs to the channel we
679 * shouldn't look for a route through that channel */
680 return false;
681
682 return true;
683}
684
685static bool payment_route_can_carry(const struct gossmap *map,
686 const struct gossmap_chan *c,

Callers 2

payment_route_can_carryFunction · 0.85

Calls 5

dst_is_excludedFunction · 0.85
payment_rootFunction · 0.85
gossmap_chan_scidFunction · 0.85
find_hintFunction · 0.85
amount_msat_greater_eqFunction · 0.85

Tested by

no test coverage detected