Skip to content

Commit a3547e2

Browse files
committed
Change default "impossibility penalty" to one Bitcoin
In general we should avoid taking paths that we are confident will not work as much possible, but we should be willing to try each payment at least once, even if its over a channel that failed recently. A full Bitcoin penalty for such a channel seems reasonable - lightning fees are unlikely to ever reach that point so such channels will be scored much worse than any other potential path, while still being below `u64::max_value()`.
1 parent ec2b1ce commit a3547e2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/routing/scoring.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ pub struct ProbabilisticScoringParameters {
406406
/// If you wish to avoid creating paths with such channels entirely, setting this to a value of
407407
/// `u64::max_value()` will guarantee that.
408408
///
409-
/// Default value: `u64::max_value()`
409+
/// Default value: 1_0000_0000_000 msat (1 Bitcoin)
410410
///
411411
/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
412412
/// [`amount_penalty_multiplier_msat`]: Self::amount_penalty_multiplier_msat
@@ -563,7 +563,7 @@ impl Default for ProbabilisticScoringParameters {
563563
amount_penalty_multiplier_msat: 256,
564564
manual_node_penalties: HashMap::new(),
565565
anti_probing_penalty_msat: 250,
566-
considered_impossible_penalty_msat: u64::max_value(),
566+
considered_impossible_penalty_msat: 1_0000_0000_000,
567567
}
568568
}
569569
}
@@ -2192,7 +2192,10 @@ mod tests {
21922192
fn accounts_for_inflight_htlc_usage() {
21932193
let logger = TestLogger::new();
21942194
let network_graph = network_graph(&logger);
2195-
let params = ProbabilisticScoringParameters::default();
2195+
let params = ProbabilisticScoringParameters {
2196+
considered_impossible_penalty_msat: u64::max_value(),
2197+
..ProbabilisticScoringParameters::zero_penalty()
2198+
};
21962199
let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
21972200
let source = source_node_id();
21982201
let target = target_node_id();

0 commit comments

Comments
 (0)