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 2023-12-22 14:17:18 +01:00
parent 9087f4045b
commit 1878fa1351
No known key found for this signature in database
GPG key ID: 1965063FC13BEBE2

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):