@@ -314,23 +314,23 @@ type ConfiguredTime = Eternity;
314
314
315
315
/// [`Score`] implementation using channel success probability distributions.
316
316
///
317
- /// Channels are tracked with upper- and lower- liquidity bounds - when an HTLC fails at a channel,
317
+ /// Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
318
318
/// we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
319
319
/// When a payment is forwarded through a channel (but fails later in the route), we learn the
320
320
/// lower-bound on the channel's available liquidity must be at least the value of the HTLC.
321
321
///
322
322
/// These bounds are then used to determine a success probability using the formula from
323
323
/// *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
324
- /// and Stefan Richter [[1]] (i.e. `(payment amount + lower-bound ) / (upper-bound - lower-bound )`).
324
+ /// and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount ) / (upper_bound - lower_bound )`).
325
325
///
326
- /// This probability is converted into a linear score and multiplying it with the
326
+ /// This probability is converted into a linear score and multiplied with the
327
327
/// [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]
328
- /// parameters to get a concrete msat value . See the documentation for those parameters for the
328
+ /// parameters to get a concrete msat penalty . See the documentation for those parameters for the
329
329
/// exact formulas.
330
330
///
331
331
/// The liquidity bounds are then decayed by halving them every [`liquidity_offset_half_life`].
332
332
///
333
- /// Further, we track the history of our upper- and lower- liquidity bounds for each channel,
333
+ /// Further, we track the history of our upper and lower liquidity bounds for each channel,
334
334
/// allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
335
335
/// and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
336
336
/// formula, but using the history of a channel rather than our latest estimates for the liquidity
@@ -406,15 +406,16 @@ pub struct ProbabilisticScoringParameters {
406
406
/// [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
407
407
pub liquidity_penalty_multiplier_msat : u64 ,
408
408
409
- /// We track upper and lower bounds on the available liquidity in a channel in order to
410
- /// calculate success probability given recent successes and failures. In order to ensure we do
411
- /// not get stuck avoiding channels which only failed once, we decay these bounds over time.
412
- ///
413
409
/// Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
414
410
/// the distance from the bounds to "zero" is cut in half. In other words, the lower-bound on
415
411
/// the available liquidity is halved and the upper-bound moves half-way to the channel's total
416
412
/// capacity.
417
413
///
414
+ /// Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
415
+ /// penalties for payments that are within the liquidity bounds will be decreased. See the
416
+ /// [`ProbabilisticScorer`] struct documentation for more info on the way the liquidity bounds
417
+ /// are used.
418
+ ///
418
419
/// For example, if the channel's capacity is 1 million sats, and the current upper- and lower-
419
420
/// liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper-
420
421
/// and lower- liquidity bounds will be decayed to 100,000 and 800,000 sats.
0 commit comments