Module scoring

Expand description

Utilities for scoring payment channels.

ProbabilisticScorer may be given to find_route to score payment channels during path finding when a custom ScoreLookUp implementation is not needed.

§Example

// Use the default channel penalties.
let params = ProbabilisticScoringFeeParameters::default();
let decay_params = ProbabilisticScoringDecayParameters::default();
let scorer = ProbabilisticScorer::new(decay_params, &network_graph, &logger);

// Or use custom channel penalties.
let params = ProbabilisticScoringFeeParameters {
	liquidity_penalty_multiplier_msat: 2 * 1000,
	..ProbabilisticScoringFeeParameters::default()
};
let decay_params = ProbabilisticScoringDecayParameters::default();
let scorer = ProbabilisticScorer::new(decay_params, &network_graph, &logger);

let route = find_route(&payer, &route_params, &network_graph, None, &logger, &scorer, &params, &random_seed_bytes);

§Note

Persisting when built with feature no-std and restoring without it, or vice versa, uses different types and thus is undefined.

Structs§

ChannelUsage
Proposed use of a channel passed as a parameter to ScoreLookUp::channel_penalty_msat.
FixedPenaltyScorer
ScoreLookUp implementation that uses a fixed penalty.
ProbabilisticScorerUsingTime
Probabilistic ScoreLookUp implementation.
ProbabilisticScoringDecayParameters
Parameters for configuring ProbabilisticScorer.
ProbabilisticScoringFeeParameters
Parameters for configuring ProbabilisticScorer.

Traits§

LockableScore
A scorer that is accessed under a lock.
Score
A trait which can both lookup and update routing channel penalty scores.
ScoreLookUp
An interface used to score payment channels for path finding.
ScoreUpdate
ScoreUpdate is used to update the scorer’s internal state after a payment attempt.
WriteableScore
Refers to a scorer that is accessible under lock and also writeable to disk

Type Aliases§

ProbabilisticScorer
ScoreLookUp implementation using channel success probability distributions.