Skip to content

Commit 5b56ca4

Browse files
committed
Simplify type aliasing somewhat around times
.. as the current C bindings generator isn't capable of handling type aliases in generics in type alias definition currently.
1 parent 2bcd067 commit 5b56ca4

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

lightning/src/routing/scoring.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,30 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
306306
}
307307

308308
#[cfg(not(feature = "no-std"))]
309-
type ConfiguredTime = std::time::Instant;
310-
#[cfg(feature = "no-std")]
311-
use util::time::Eternity;
309+
/// [`Score`] implementation using channel success probability distributions.
310+
///
311+
/// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
312+
/// and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
313+
/// distributions are defined based on knowledge learned from successful and unsuccessful attempts.
314+
/// Then the negative `log10` of the success probability is used to determine the cost of routing a
315+
/// specific HTLC amount through a channel.
316+
///
317+
/// Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
318+
/// possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
319+
/// [`ProbabilisticScoringParameters`] for details.
320+
///
321+
/// Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
322+
/// with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
323+
/// volume are more likely to experience failed payment paths, which would need to be retried.
324+
///
325+
/// # Note
326+
///
327+
/// Mixing the `no-std` feature between serialization and deserialization results in undefined
328+
/// behavior.
329+
///
330+
/// [1]: https://arxiv.org/abs/2107.05322
331+
pub type ProbabilisticScorer<G, L> = ProbabilisticScorerUsingTime::<G, L, std::time::Instant>;
312332
#[cfg(feature = "no-std")]
313-
type ConfiguredTime = Eternity;
314-
315333
/// [`Score`] implementation using channel success probability distributions.
316334
///
317335
/// Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
@@ -334,7 +352,7 @@ type ConfiguredTime = Eternity;
334352
/// behavior.
335353
///
336354
/// [1]: https://arxiv.org/abs/2107.05322
337-
pub type ProbabilisticScorer<G, L> = ProbabilisticScorerUsingTime::<G, L, ConfiguredTime>;
355+
pub type ProbabilisticScorer<G, L> = ProbabilisticScorerUsingTime::<G, L, ::util::time::Eternity>;
338356

339357
/// Probabilistic [`Score`] implementation.
340358
///

0 commit comments

Comments
 (0)