Change default "impossibility penalty" to one Bitcoin 2022-07-explicit-avoid-retries
authorMatt Corallo <git@bluematt.me>
Thu, 7 Jul 2022 17:37:22 +0000 (17:37 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 14 Jul 2022 18:37:26 +0000 (18:37 +0000)
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()`.

lightning/src/routing/scoring.rs

index cd2ae6d5d01cbcf26dd409244ee0e2a086a969d1..e2e0bdd18a6eddf714ce3288643a0efb1d4d8ca7 100644 (file)
@@ -406,7 +406,7 @@ pub struct ProbabilisticScoringParameters {
        /// If you wish to avoid creating paths with such channels entirely, setting this to a value of
        /// `u64::max_value()` will guarantee that.
        ///
-       /// Default value: `u64::max_value()`
+       /// Default value: 1_0000_0000_000 msat (1 Bitcoin)
        ///
        /// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
        /// [`amount_penalty_multiplier_msat`]: Self::amount_penalty_multiplier_msat
@@ -563,7 +563,7 @@ impl Default for ProbabilisticScoringParameters {
                        amount_penalty_multiplier_msat: 256,
                        manual_node_penalties: HashMap::new(),
                        anti_probing_penalty_msat: 250,
-                       considered_impossible_penalty_msat: u64::max_value(),
+                       considered_impossible_penalty_msat: 1_0000_0000_000,
                }
        }
 }
@@ -2192,7 +2192,10 @@ mod tests {
        fn accounts_for_inflight_htlc_usage() {
                let logger = TestLogger::new();
                let network_graph = network_graph(&logger);
-               let params = ProbabilisticScoringParameters::default();
+               let params = ProbabilisticScoringParameters {
+                       considered_impossible_penalty_msat: u64::max_value(),
+                       ..ProbabilisticScoringParameters::zero_penalty()
+               };
                let scorer = ProbabilisticScorer::new(params, &network_graph, &logger);
                let source = source_node_id();
                let target = target_node_id();