pub trait Score {
    // Required methods
    fn channel_penalty_msat(
        &self,
        short_channel_id: u64,
        source: &NodeId,
        target: &NodeId,
        usage: ChannelUsage
    ) -> u64;
    fn payment_path_failed(&mut self, path: &Path, short_channel_id: u64);
    fn payment_path_successful(&mut self, path: &Path);
    fn probe_failed(&mut self, path: &Path, short_channel_id: u64);
    fn probe_successful(&mut self, path: &Path);
}
Expand description

An interface used to score payment channels for path finding.

Scoring is in terms of fees willing to be paid in order to avoid routing through a channel.

Required Methods§

source

fn channel_penalty_msat( &self, short_channel_id: u64, source: &NodeId, target: &NodeId, usage: ChannelUsage ) -> 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.

source

fn payment_path_failed(&mut self, path: &Path, short_channel_id: u64)

Handles updating channel penalties after failing to route through a channel.

source

fn payment_path_successful(&mut self, path: &Path)

Handles updating channel penalties after successfully routing along a path.

source

fn probe_failed(&mut self, path: &Path, short_channel_id: u64)

Handles updating channel penalties after a probe over the given path failed.

source

fn probe_successful(&mut self, path: &Path)

Handles updating channel penalties after a probe over the given path succeeded.

Implementors§

source§

impl Score for FixedPenaltyScorer

source§

impl<'a, S: Score> Score for ScorerAccountingForInFlightHtlcs<'a, S>

source§

impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Score for ProbabilisticScorerUsingTime<G, L, T>where L::Target: Logger,

source§

impl<S: Score, T: DerefMut<Target = S>> Score for T