Skip to content

Commit a863778

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 adf1872 commit a863778

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
@@ -403,7 +403,7 @@ pub struct ProbabilisticScoringParameters {
403403
/// If you wish to avoid creating paths with such channels entirely, setting this to a value of
404404
/// `u64::max_value()` will guarantee that.
405405
///
406-
/// Default value: `u64::max_value()`
406+
/// Default value: 1_0000_0000_000 msat (1 Bitcoin)
407407
///
408408
/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
409409
/// [`amount_penalty_multiplier_msat`]: Self::amount_penalty_multiplier_msat
@@ -548,7 +548,7 @@ impl Default for ProbabilisticScoringParameters {
548548
amount_penalty_multiplier_msat: 256,
549549
banned_nodes: HashSet::new(),
550550
anti_probing_penalty_msat: 250,
551-
considered_impossible_penalty_msat: u64::max_value(),
551+
considered_impossible_penalty_msat: 1_0000_0000_000,
552552
}
553553
}
554554
}
@@ -2165,7 +2165,10 @@ mod tests {
21652165
fn accounts_for_inflight_htlc_usage() {
21662166
let logger = TestLogger::new();
21672167
let network_graph = network_graph(&logger);
2168-
let params = ProbabilisticScoringParameters::default();
2168+
let params = ProbabilisticScoringParameters {
2169+
considered_impossible_penalty_msat: u64::max_value(),
2170+
..ProbabilisticScoringParameters::zero_penalty()
2171+
};
21692172
let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
21702173
let source = source_node_id();
21712174
let target = target_node_id();

0 commit comments

Comments
 (0)