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.
This commit is contained in:
bitromortac committed 2025-05-02 10:30:28 +02:00
1 parent 3819941c12
commit 5ba9619d22
1 file changed
+5
+5
View File
@@ -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):