]> git.bitcoin.ninja Git - rust-lightning/commitdiff
f - Include fees when calculating cost
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 25 Jan 2022 17:07:00 +0000 (11:07 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 25 Jan 2022 17:29:33 +0000 (11:29 -0600)
lightning/src/routing/scoring.rs

index 7d56892752f4ec32c06150cec4b903532de99da1..915be8bdd1279434eb19c067b87580c3cbb369b7 100644 (file)
@@ -417,7 +417,7 @@ impl<T: Time> Score for ScorerUsingTime<T> {
                                .unwrap_or(u64::max_value());
                }
 
-               penalty_msat
+               params.fees_msat.checked_add(penalty_msat).unwrap_or(u64::max_value())
        }
 
        fn payment_path_failed(&mut self, _path: &[&RouteHop], short_channel_id: u64) {
@@ -761,9 +761,9 @@ impl<G: Deref<Target = NetworkGraph>, T: Time> Score for ProbabilisticScorerUsin
                if success_probability == 0.0 {
                        u64::max_value()
                } else if success_probability == 1.0 {
-                       0
+                       params.fees_msat
                } else {
-                       (-(success_probability.log10()) * liquidity_penalty_multiplier_msat as f64) as u64
+                       params.fees_msat + (-(success_probability.log10()) * liquidity_penalty_multiplier_msat as f64) as u64
                }
        }