@@ -230,6 +230,7 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
230
230
}
231
231
}
232
232
233
+ #[ cfg( not( feature = "no-std" ) ) ]
233
234
/// [`Score`] implementation that provides reasonable default behavior.
234
235
///
235
236
/// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
@@ -247,9 +248,21 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
247
248
since = "0.0.105" ,
248
249
note = "ProbabilisticScorer should be used instead of Scorer." ,
249
250
) ]
250
- #[ cfg( not( feature = "no-std" ) ) ]
251
251
pub type Scorer = ScorerUsingTime :: < std:: time:: Instant > ;
252
252
#[ cfg( feature = "no-std" ) ]
253
+ /// [`Score`] implementation that provides reasonable default behavior.
254
+ ///
255
+ /// Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
256
+ /// slightly higher fees are available. Will further penalize channels that fail to relay payments.
257
+ ///
258
+ /// See [module-level documentation] for usage and [`ScoringParameters`] for customization.
259
+ ///
260
+ /// # Note
261
+ ///
262
+ /// Mixing the `no-std` feature between serialization and deserialization results in undefined
263
+ /// behavior.
264
+ ///
265
+ /// [module-level documentation]: crate::routing::scoring
253
266
pub type Scorer = ScorerUsingTime :: < time:: Eternity > ;
254
267
255
268
// Note that ideally we'd hide ScorerUsingTime from public view by sealing it as well, but rustdoc
@@ -479,6 +492,7 @@ impl<T: Time> Readable for ChannelFailure<T> {
479
492
}
480
493
}
481
494
495
+ #[ cfg( not( feature = "no-std" ) ) ]
482
496
/// [`Score`] implementation using channel success probability distributions.
483
497
///
484
498
/// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
@@ -501,9 +515,30 @@ impl<T: Time> Readable for ChannelFailure<T> {
501
515
/// behavior.
502
516
///
503
517
/// [1]: https://arxiv.org/abs/2107.05322
504
- #[ cfg( not( feature = "no-std" ) ) ]
505
518
pub type ProbabilisticScorer < G > = ProbabilisticScorerUsingTime :: < G , std:: time:: Instant > ;
506
519
#[ cfg( feature = "no-std" ) ]
520
+ /// [`Score`] implementation using channel success probability distributions.
521
+ ///
522
+ /// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
523
+ /// and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
524
+ /// distributions are defined based on knowledge learned from successful and unsuccessful attempts.
525
+ /// Then the negative `log10` of the success probability is used to determine the cost of routing a
526
+ /// specific HTLC amount through a channel.
527
+ ///
528
+ /// Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
529
+ /// possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
530
+ /// [`ProbabilisticScoringParameters`] for details.
531
+ ///
532
+ /// Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
533
+ /// with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
534
+ /// volume are more likely to experience failed payment paths, which would need to be retried.
535
+ ///
536
+ /// # Note
537
+ ///
538
+ /// Mixing the `no-std` feature between serialization and deserialization results in undefined
539
+ /// behavior.
540
+ ///
541
+ /// [1]: https://arxiv.org/abs/2107.05322
507
542
pub type ProbabilisticScorer < G > = ProbabilisticScorerUsingTime :: < G , time:: Eternity > ;
508
543
509
544
/// Probabilistic [`Score`] implementation.
0 commit comments