Skip to content

Commit 5ba9619

Browse files
committed
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.
1 parent 3819941 commit 5ba9619

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routing/probability_bimodal.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,11 @@ func (p *BimodalEstimator) probabilityFormula(capacityMsat, successAmountMsat,
525525
return 0.0, nil
526526
}
527527

528+
// We can send the amount if it is smaller than the success amount.
529+
if amount <= successAmount {
530+
return 1.0, nil
531+
}
532+
528533
// The success probability for payment amount a is the integral over the
529534
// prior distribution P(x), the probability to find liquidity between
530535
// the amount a and channel capacity c (or failAmount a_f):

0 commit comments

Comments
 (0)