Skip to content

Commit eea6311

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 505ac9d commit eea6311

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
@@ -404,7 +404,7 @@ pub struct ProbabilisticScoringParameters {
404404
/// If you wish to avoid creating paths with such channels entirely, setting this to a value of
405405
/// `u64::max_value()` will guarantee that.
406406
///
407-
/// Default value: `u64::max_value()`
407+
/// Default value: 1_0000_0000_000 msat (1 Bitcoin)
408408
///
409409
/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
410410
/// [`amount_penalty_multiplier_msat`]: Self::amount_penalty_multiplier_msat
@@ -551,7 +551,7 @@ impl Default for ProbabilisticScoringParameters {
551551
amount_penalty_multiplier_msat: 256,
552552
banned_nodes: HashSet::new(),
553553
anti_probing_penalty_msat: 250,
554-
considered_impossible_penalty_msat: u64::max_value(),
554+
considered_impossible_penalty_msat: 1_0000_0000_000,
555555
}
556556
}
557557
}
@@ -2168,7 +2168,10 @@ mod tests {
21682168
fn accounts_for_inflight_htlc_usage() {
21692169
let logger = TestLogger::new();
21702170
let network_graph = network_graph(&logger);
2171-
let params = ProbabilisticScoringParameters::default();
2171+
let params = ProbabilisticScoringParameters {
2172+
considered_impossible_penalty_msat: u64::max_value(),
2173+
..ProbabilisticScoringParameters::zero_penalty()
2174+
};
21722175
let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
21732176
let source = source_node_id();
21742177
let target = target_node_id();

0 commit comments

Comments
 (0)