Skip to content

Commit e3396ef

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 846291f commit e3396ef

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
pub considered_impossible_penalty_msat: u64,
408408
}
409409

@@ -545,7 +545,7 @@ impl Default for ProbabilisticScoringParameters {
545545
amount_penalty_multiplier_msat: 256,
546546
banned_nodes: HashSet::new(),
547547
anti_probing_penalty_msat: 250,
548-
considered_impossible_penalty_msat: u64::max_value(),
548+
considered_impossible_penalty_msat: 1_0000_0000_000,
549549
}
550550
}
551551
}
@@ -2162,7 +2162,10 @@ mod tests {
21622162
fn accounts_for_inflight_htlc_usage() {
21632163
let logger = TestLogger::new();
21642164
let network_graph = network_graph(&logger);
2165-
let params = ProbabilisticScoringParameters::default();
2165+
let params = ProbabilisticScoringParameters {
2166+
considered_impossible_penalty_msat: u64::max_value(),
2167+
..ProbabilisticScoringParameters::zero_penalty()
2168+
};
21662169
let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
21672170
let source = source_node_id();
21682171
let target = target_node_id();

0 commit comments

Comments
 (0)