@@ -488,7 +488,13 @@ where L::Target: Logger {
488
488
pub struct ProbabilisticScoringFeeParameters {
489
489
/// A fixed penalty in msats to apply to each channel.
490
490
///
491
- /// Default value: 500 msat
491
+ /// In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`]
492
+ /// (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the
493
+ /// most accurate total success probabilities.
494
+ ///
495
+ /// Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop).
496
+ ///
497
+ /// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat
492
498
pub base_penalty_msat : u64 ,
493
499
494
500
/// A multiplier used with the payment amount to calculate a fixed penalty applied to each
@@ -500,9 +506,16 @@ pub struct ProbabilisticScoringFeeParameters {
500
506
///
501
507
/// ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
502
508
///
503
- /// Default value: 8,192 msat
509
+ /// In testing, a value of roughly ~100x (1/10th * 2^10) of
510
+ /// [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated
511
+ /// probabilities down by a factor of ~79%) resulted in the most accurate total success
512
+ /// probabilities.
513
+ ///
514
+ /// Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional
515
+ /// hop).
504
516
///
505
517
/// [`base_penalty_msat`]: Self::base_penalty_msat
518
+ /// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat
506
519
pub base_penalty_amount_multiplier_msat : u64 ,
507
520
508
521
/// A multiplier used in conjunction with the negative `log10` of the channel's success
@@ -518,9 +531,14 @@ pub struct ProbabilisticScoringFeeParameters {
518
531
///
519
532
/// `-log10(success_probability) * liquidity_penalty_multiplier_msat`
520
533
///
521
- /// Default value: 30,000 msat
534
+ /// In testing, this scoring model performs much worse than the historical scoring model
535
+ /// configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled
536
+ /// by default.
537
+ ///
538
+ /// Default value: 0 msat
522
539
///
523
540
/// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
541
+ /// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat
524
542
pub liquidity_penalty_multiplier_msat : u64 ,
525
543
526
544
/// A multiplier used in conjunction with the payment amount and the negative `log10` of the
@@ -540,7 +558,13 @@ pub struct ProbabilisticScoringFeeParameters {
540
558
/// probabilities, the multiplier will have a decreasing effect as the negative `log10` will
541
559
/// fall below `1`.
542
560
///
543
- /// Default value: 192 msat
561
+ /// In testing, this scoring model performs much worse than the historical scoring model
562
+ /// configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is
563
+ /// disabled by default.
564
+ ///
565
+ /// Default value: 0 msat
566
+ ///
567
+ /// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat
544
568
pub liquidity_penalty_amount_multiplier_msat : u64 ,
545
569
546
570
/// A multiplier used in conjunction with the negative `log10` of the channel's success
@@ -554,7 +578,8 @@ pub struct ProbabilisticScoringFeeParameters {
554
578
/// track which of several buckets those bounds fall into, exponentially decaying the
555
579
/// probability of each bucket as new samples are added.
556
580
///
557
- /// Default value: 10,000 msat
581
+ /// Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel,
582
+ /// or 6 sats to avoid a 25% probability channel).
558
583
///
559
584
/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
560
585
pub historical_liquidity_penalty_multiplier_msat : u64 ,
@@ -575,7 +600,9 @@ pub struct ProbabilisticScoringFeeParameters {
575
600
/// channel, we track which of several buckets those bounds fall into, exponentially decaying
576
601
/// the probability of each bucket as new samples are added.
577
602
///
578
- /// Default value: 64 msat
603
+ /// Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78%
604
+ /// probability channels, or 0.5bps to avoid a 38% probability
605
+ /// channel).
579
606
///
580
607
/// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
581
608
pub historical_liquidity_penalty_amount_multiplier_msat : u64 ,
@@ -642,15 +669,15 @@ pub struct ProbabilisticScoringFeeParameters {
642
669
impl Default for ProbabilisticScoringFeeParameters {
643
670
fn default ( ) -> Self {
644
671
Self {
645
- base_penalty_msat : 500 ,
646
- base_penalty_amount_multiplier_msat : 8192 ,
647
- liquidity_penalty_multiplier_msat : 30_000 ,
648
- liquidity_penalty_amount_multiplier_msat : 192 ,
672
+ base_penalty_msat : 1024 ,
673
+ base_penalty_amount_multiplier_msat : 131_072 ,
674
+ liquidity_penalty_multiplier_msat : 0 ,
675
+ liquidity_penalty_amount_multiplier_msat : 0 ,
649
676
manual_node_penalties : new_hash_map ( ) ,
650
677
anti_probing_penalty_msat : 250 ,
651
678
considered_impossible_penalty_msat : 1_0000_0000_000 ,
652
679
historical_liquidity_penalty_multiplier_msat : 10_000 ,
653
- historical_liquidity_penalty_amount_multiplier_msat : 64 ,
680
+ historical_liquidity_penalty_amount_multiplier_msat : 1_250 ,
654
681
linear_success_probability : false ,
655
682
}
656
683
}
@@ -3017,47 +3044,47 @@ mod tests {
3017
3044
info,
3018
3045
short_channel_id : 42 ,
3019
3046
} ) ;
3020
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 11577 ) ;
3047
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 42_252 ) ;
3021
3048
let usage = ChannelUsage {
3022
3049
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 1_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3023
3050
} ;
3024
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 8462 ) ;
3051
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 36_005 ) ;
3025
3052
let usage = ChannelUsage {
3026
3053
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 2_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3027
3054
} ;
3028
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 6889 ) ;
3055
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 32_851 ) ;
3029
3056
let usage = ChannelUsage {
3030
3057
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 3_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3031
3058
} ;
3032
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 5883 ) ;
3059
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 30_832 ) ;
3033
3060
let usage = ChannelUsage {
3034
3061
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 4_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3035
3062
} ;
3036
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 5412 ) ;
3063
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 29_886 ) ;
3037
3064
let usage = ChannelUsage {
3038
3065
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 5_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3039
3066
} ;
3040
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4940 ) ;
3067
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 28_939 ) ;
3041
3068
let usage = ChannelUsage {
3042
3069
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 6_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3043
3070
} ;
3044
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4689 ) ;
3071
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 28_435 ) ;
3045
3072
let usage = ChannelUsage {
3046
3073
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 7_450_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3047
3074
} ;
3048
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4468 ) ;
3075
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 27_993 ) ;
3049
3076
let usage = ChannelUsage {
3050
3077
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 7_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3051
3078
} ;
3052
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4468 ) ;
3079
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 27_993 ) ;
3053
3080
let usage = ChannelUsage {
3054
3081
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 8_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3055
3082
} ;
3056
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4217 ) ;
3083
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 27_488 ) ;
3057
3084
let usage = ChannelUsage {
3058
3085
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 9_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3059
3086
} ;
3060
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 3996 ) ;
3087
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 27_047 ) ;
3061
3088
}
3062
3089
3063
3090
#[ test]
0 commit comments