Skip to content

Commit 9596cc7

Browse files
committed
Increase default liquidity_penalty_multiplier_msat
Using a larger multiplier gives more reasonable penalties for larger success probabilities.
1 parent c6348cb commit 9596cc7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lightning/src/routing/scoring.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ pub struct ProbabilisticScoringParameters {
533533
/// payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
534534
/// penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat`.
535535
///
536-
/// Default value: 10,000 msat
536+
/// Default value: 40,000 msat
537537
///
538538
/// [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
539539
pub liquidity_penalty_multiplier_msat: u64,
@@ -603,7 +603,7 @@ impl Default for ProbabilisticScoringParameters {
603603
fn default() -> Self {
604604
Self {
605605
base_penalty_msat: 500,
606-
liquidity_penalty_multiplier_msat: 10_000,
606+
liquidity_penalty_multiplier_msat: 40_000,
607607
liquidity_offset_half_life: Duration::from_secs(3600),
608608
}
609609
}
@@ -2051,16 +2051,16 @@ mod tests {
20512051
let target = target_node_id();
20522052

20532053
let params = ProbabilisticScoringParameters {
2054-
base_penalty_msat: 0, ..Default::default()
2054+
base_penalty_msat: 0, liquidity_penalty_multiplier_msat: 1_000, ..Default::default()
20552055
};
20562056
let scorer = ProbabilisticScorer::new(params, &network_graph);
2057-
assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 585);
2057+
assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 58);
20582058

20592059
let params = ProbabilisticScoringParameters {
2060-
base_penalty_msat: 500, ..Default::default()
2060+
base_penalty_msat: 500, liquidity_penalty_multiplier_msat: 1_000, ..Default::default()
20612061
};
20622062
let scorer = ProbabilisticScorer::new(params, &network_graph);
2063-
assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 1085);
2063+
assert_eq!(scorer.channel_penalty_msat(42, 128, 1_024, &source, &target), 558);
20642064
}
20652065

20662066
#[test]
@@ -2075,7 +2075,7 @@ mod tests {
20752075
let scorer = ProbabilisticScorer::new(params, &network_graph);
20762076
assert_eq!(
20772077
scorer.channel_penalty_msat(42, u64::max_value(), u64::max_value(), &source, &target),
2078-
20_000,
2078+
80_000,
20792079
);
20802080
}
20812081
}

0 commit comments

Comments
 (0)