Skip to content

Commit 0d38ad9

Browse files
committed
f clarify comment
1 parent 3626230 commit 0d38ad9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/routing/scoring.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,10 @@ fn success_probability(
10511051
// the amount, divided by the same integral from the minimum to the maximum liquidity
10521052
// bounds.
10531053
//
1054-
// Because the integral is simply a constant times (x - 0.5)^3, this means we simply
1055-
// subtract the two bounds mius 0.5 to the 3rd power.
1054+
// Because the integral from x to y is simply (y - 0.5)^3 - (x - 0.5)^3, we can
1055+
// calculate the cumulative density function between the min/max bounds trivially. Note
1056+
// that we don't bother to normalize the CDF to total to 1, as it will come out in the
1057+
// division of num / den.
10561058
let max_pow = (max - 0.5).powi(3);
10571059
let num = max_pow - (amount - 0.5).powi(3);
10581060
let den = max_pow - (min - 0.5).powi(3);

0 commit comments

Comments
 (0)