@@ -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: 262,144 msat (i.e. we're willing to pay 0.25bps 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,13 @@ 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 that the historical scoring model configured with
535
+ /// the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled by default.
536
+ ///
537
+ /// Default value: 0 msat
522
538
///
523
539
/// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
540
+ /// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat
524
541
pub liquidity_penalty_multiplier_msat : u64 ,
525
542
526
543
/// A multiplier used in conjunction with the payment amount and the negative `log10` of the
@@ -540,7 +557,13 @@ pub struct ProbabilisticScoringFeeParameters {
540
557
/// probabilities, the multiplier will have a decreasing effect as the negative `log10` will
541
558
/// fall below `1`.
542
559
///
543
- /// Default value: 192 msat
560
+ /// In testing, this scoring model performs that the historical scoring model configured with
561
+ /// the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is disabled by
562
+ /// default.
563
+ ///
564
+ /// Default value: 0 msat
565
+ ///
566
+ /// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat
544
567
pub liquidity_penalty_amount_multiplier_msat : u64 ,
545
568
546
569
/// A multiplier used in conjunction with the negative `log10` of the channel's success
@@ -554,7 +577,8 @@ pub struct ProbabilisticScoringFeeParameters {
554
577
/// track which of several buckets those bounds fall into, exponentially decaying the
555
578
/// probability of each bucket as new samples are added.
556
579
///
557
- /// Default value: 10,000 msat
580
+ /// Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel,
581
+ /// or 6 sats to avoid a 25% probability channel).
558
582
///
559
583
/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
560
584
pub historical_liquidity_penalty_multiplier_msat : u64 ,
@@ -575,7 +599,9 @@ pub struct ProbabilisticScoringFeeParameters {
575
599
/// channel, we track which of several buckets those bounds fall into, exponentially decaying
576
600
/// the probability of each bucket as new samples are added.
577
601
///
578
- /// Default value: 64 msat
602
+ /// Default value: 2,500 msat (i.e. willing to pay about 0.25 bps per hop to avoid 78%
603
+ /// probability channels, or 1bp to avoid a 38% probability
604
+ /// channel).
579
605
///
580
606
/// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
581
607
pub historical_liquidity_penalty_amount_multiplier_msat : u64 ,
@@ -642,15 +668,15 @@ pub struct ProbabilisticScoringFeeParameters {
642
668
impl Default for ProbabilisticScoringFeeParameters {
643
669
fn default ( ) -> Self {
644
670
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 ,
671
+ base_penalty_msat : 1024 ,
672
+ base_penalty_amount_multiplier_msat : 1024 ,
673
+ liquidity_penalty_multiplier_msat : 0 ,
674
+ liquidity_penalty_amount_multiplier_msat : 0 ,
649
675
manual_node_penalties : new_hash_map ( ) ,
650
676
anti_probing_penalty_msat : 250 ,
651
677
considered_impossible_penalty_msat : 1_0000_0000_000 ,
652
678
historical_liquidity_penalty_multiplier_msat : 10_000 ,
653
- historical_liquidity_penalty_amount_multiplier_msat : 64 ,
679
+ historical_liquidity_penalty_amount_multiplier_msat : 2_500 ,
654
680
linear_success_probability : false ,
655
681
}
656
682
}
@@ -3017,47 +3043,47 @@ mod tests {
3017
3043
info,
3018
3044
short_channel_id : 42 ,
3019
3045
} ) ;
3020
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 11577 ) ;
3046
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 56_916 ) ;
3021
3047
let usage = ChannelUsage {
3022
3048
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 1_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3023
3049
} ;
3024
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 8462 ) ;
3050
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 44_906 ) ;
3025
3051
let usage = ChannelUsage {
3026
3052
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 2_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3027
3053
} ;
3028
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 6889 ) ;
3054
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 38_842 ) ;
3029
3055
let usage = ChannelUsage {
3030
3056
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 3_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3031
3057
} ;
3032
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 5883 ) ;
3058
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 34_960 ) ;
3033
3059
let usage = ChannelUsage {
3034
3060
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 4_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3035
3061
} ;
3036
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 5412 ) ;
3062
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 33_141 ) ;
3037
3063
let usage = ChannelUsage {
3038
3064
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 5_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3039
3065
} ;
3040
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4940 ) ;
3066
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 31_321 ) ;
3041
3067
let usage = ChannelUsage {
3042
3068
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 6_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3043
3069
} ;
3044
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4689 ) ;
3070
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 30_351 ) ;
3045
3071
let usage = ChannelUsage {
3046
3072
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 7_450_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3047
3073
} ;
3048
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4468 ) ;
3074
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 29_502 ) ;
3049
3075
let usage = ChannelUsage {
3050
3076
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 7_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3051
3077
} ;
3052
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4468 ) ;
3078
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 29_502 ) ;
3053
3079
let usage = ChannelUsage {
3054
3080
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 8_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3055
3081
} ;
3056
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 4217 ) ;
3082
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 28_531 ) ;
3057
3083
let usage = ChannelUsage {
3058
3084
effective_capacity : EffectiveCapacity :: Total { capacity_msat : 9_950_000_000 , htlc_maximum_msat : 1_000 } , ..usage
3059
3085
} ;
3060
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 3996 ) ;
3086
+ assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 27_682 ) ;
3061
3087
}
3062
3088
3063
3089
#[ test]
0 commit comments