Trait lightning::routing::scoring::ScoreLookUp
source · pub trait ScoreLookUp {
type ScoreParams;
// Required method
fn channel_penalty_msat(
&self,
candidate: &CandidateRouteHop<'_>,
usage: ChannelUsage,
score_params: &Self::ScoreParams
) -> u64;
}
Expand description
An interface used to score payment channels for path finding.
ScoreLookUp
is used to determine the penalty for a given channel.
Scoring is in terms of fees willing to be paid in order to avoid routing through a channel.
Required Associated Types§
sourcetype ScoreParams
type ScoreParams
A configurable type which should contain various passed-in parameters for configuring the scorer, on a per-routefinding-call basis through to the scorer methods, which are used to determine the parameters for the suitability of channels for use.
Required Methods§
sourcefn channel_penalty_msat(
&self,
candidate: &CandidateRouteHop<'_>,
usage: ChannelUsage,
score_params: &Self::ScoreParams
) -> u64
fn channel_penalty_msat( &self, candidate: &CandidateRouteHop<'_>, usage: ChannelUsage, score_params: &Self::ScoreParams ) -> u64
Returns the fee in msats willing to be paid to avoid routing send_amt_msat
through the
given channel in the direction from source
to target
.
The channel’s capacity (less any other MPP parts that are also being considered for use in
the same payment) is given by capacity_msat
. It may be determined from various sources
such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
u64::max_value
is given to indicate sufficient capacity for the invoice’s full amount.
Thus, implementations should be overflow-safe.
Implementors§
source§impl ScoreLookUp for FixedPenaltyScorer
impl ScoreLookUp for FixedPenaltyScorer
type ScoreParams = ()
source§impl<'a, S: Deref> ScoreLookUp for ScorerAccountingForInFlightHtlcs<'a, S>where
S::Target: ScoreLookUp,
impl<'a, S: Deref> ScoreLookUp for ScorerAccountingForInFlightHtlcs<'a, S>where
S::Target: ScoreLookUp,
type ScoreParams = <<S as Deref>::Target as ScoreLookUp>::ScoreParams
source§impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for ProbabilisticScorer<G, L>
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for ProbabilisticScorer<G, L>
source§impl<S: ScoreLookUp, T: Deref<Target = S>> ScoreLookUp for T
Available on non-c_bindings
only.
impl<S: ScoreLookUp, T: Deref<Target = S>> ScoreLookUp for T
c_bindings
only.