@@ -215,6 +215,7 @@ impl Score for FixedPenaltyScorer {
215
215
fn payment_path_successful ( & mut self , _path : & [ & RouteHop ] ) { }
216
216
}
217
217
218
+ #[ cfg( not( feature = "no-std" ) ) ]
218
219
/// [`Score`] implementation that provides reasonable default behavior.
219
220
///
220
221
/// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
@@ -232,9 +233,21 @@ impl Score for FixedPenaltyScorer {
232
233
since = "0.0.105" ,
233
234
note = "ProbabilisticScorer should be used instead of Scorer." ,
234
235
) ]
235
- #[ cfg( not( feature = "no-std" ) ) ]
236
236
pub type Scorer = ScorerUsingTime :: < std:: time:: Instant > ;
237
237
#[ cfg( feature = "no-std" ) ]
238
+ /// [`Score`] implementation that provides reasonable default behavior.
239
+ ///
240
+ /// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
241
+ /// slightly higher fees are available. Will further penalize channels that fail to relay payments.
242
+ ///
243
+ /// See [module-level documentation] for usage and [`ScoringParameters`] for customization.
244
+ ///
245
+ /// # Note
246
+ ///
247
+ /// Mixing the `no-std` feature between serialization and deserialization results in undefined
248
+ /// behavior.
249
+ ///
250
+ /// [module-level documentation]: crate::routing::scoring
238
251
pub type Scorer = ScorerUsingTime :: < time:: Eternity > ;
239
252
240
253
// Note that ideally we'd hide ScorerUsingTime from public view by sealing it as well, but rustdoc
@@ -463,6 +476,7 @@ impl<T: Time> Readable for ChannelFailure<T> {
463
476
}
464
477
}
465
478
479
+ #[ cfg( not( feature = "no-std" ) ) ]
466
480
/// [`Score`] implementation using channel success probability distributions.
467
481
///
468
482
/// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
@@ -485,9 +499,30 @@ impl<T: Time> Readable for ChannelFailure<T> {
485
499
/// behavior.
486
500
///
487
501
/// [1]: https://arxiv.org/abs/2107.05322
488
- #[ cfg( not( feature = "no-std" ) ) ]
489
502
pub type ProbabilisticScorer < G > = ProbabilisticScorerUsingTime :: < G , std:: time:: Instant > ;
490
503
#[ cfg( feature = "no-std" ) ]
504
+ /// [`Score`] implementation using channel success probability distributions.
505
+ ///
506
+ /// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
507
+ /// and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
508
+ /// distributions are defined based on knowledge learned from successful and unsuccessful attempts.
509
+ /// Then the negative `log10` of the success probability is used to determine the cost of routing a
510
+ /// specific HTLC amount through a channel.
511
+ ///
512
+ /// Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
513
+ /// possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
514
+ /// [`ProbabilisticScoringParameters`] for details.
515
+ ///
516
+ /// Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
517
+ /// with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
518
+ /// volume are more likely to experience failed payment paths, which would need to be retried.
519
+ ///
520
+ /// # Note
521
+ ///
522
+ /// Mixing the `no-std` feature between serialization and deserialization results in undefined
523
+ /// behavior.
524
+ ///
525
+ /// [1]: https://arxiv.org/abs/2107.05322
491
526
pub type ProbabilisticScorer < G > = ProbabilisticScorerUsingTime :: < G , time:: Eternity > ;
492
527
493
528
/// Probabilistic [`Score`] implementation.
0 commit comments