From 5ba9619d22d37f5ce3fd06a685a16c342e2571e1 Mon Sep 17 00:00:00 2001 From: bitromortac Date: Fri, 22 Dec 2023 14:17:18 +0100 Subject: [PATCH] routing: don't compute prob for success amounts We skip the evaluation of probabilities when the amount is lower than the last success amount, as the probability would be evaluated to 1 in that case. --- routing/probability_bimodal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routing/probability_bimodal.go b/routing/probability_bimodal.go index 3b60c006f..5f6ff587b 100644 --- a/routing/probability_bimodal.go +++ b/routing/probability_bimodal.go @@ -525,6 +525,11 @@ func (p *BimodalEstimator) probabilityFormula(capacityMsat, successAmountMsat, return 0.0, nil } + // We can send the amount if it is smaller than the success amount. + if amount <= successAmount { + return 1.0, nil + } + // The success probability for payment amount a is the integral over the // prior distribution P(x), the probability to find liquidity between // the amount a and channel capacity c (or failAmount a_f):