From 9596cc71103168d041adcdd4a3c247595c1d4c34 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Fri, 25 Mar 2022 09:41:14 -0500 Subject: [PATCH] Increase default liquidity_penalty_multiplier_msat Using a larger multiplier gives more reasonable penalties for larger success probabilities. --- lightning/src/routing/scoring.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 36e1333b9..459303f7d 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -533,7 +533,7 @@ pub struct ProbabilisticScoringParameters { /// payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The /// penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat`. /// - /// Default value: 10,000 msat + /// Default value: 40,000 msat /// /// [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life pub liquidity_penalty_multiplier_msat: u64, @@ -603,7 +603,7 @@ impl Default for ProbabilisticScoringParameters { fn default() -> Self { Self { base_penalty_msat: 500, - liquidity_penalty_multiplier_msat: 10_000, + liquidity_penalty_multiplier_msat: 40_000, liquidity_offset_half_life: Duration::from_secs(3600), } } @@ -2051,16 +2051,16 @@ mod tests { let target = target_node_id(); let params = ProbabilisticScoringParameters { - base_penalty_msat: 0, ..Default::default() + base_penalty_msat: 0, liquidity_penalty_multiplier_msat: 1_000, ..Default::default() }; let scorer = ProbabilisticScorer::new(params, &network_graph); - assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 585); + assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 58); let params = ProbabilisticScoringParameters { - base_penalty_msat: 500, ..Default::default() + base_penalty_msat: 500, liquidity_penalty_multiplier_msat: 1_000, ..Default::default() }; let scorer = ProbabilisticScorer::new(params, &network_graph); - assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 1085); + assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 558); } #[test] @@ -2075,7 +2075,7 @@ mod tests { let scorer = ProbabilisticScorer::new(params, &network_graph); assert_eq!( scorer.channel_penalty_msat(42, u64::max_value(), u64::max_value(), &source, &target), - 20_000, + 80_000, ); } } -- 2.39.5