Correctly apply penalty bounds on the per-amount penalties
authorMatt Corallo <git@bluematt.me>
Mon, 10 Apr 2023 22:54:48 +0000 (22:54 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 23 Aug 2023 21:15:11 +0000 (21:15 +0000)
commitc4947acaec808ff3568e3c168ac942d9cfcdb9b0
treebf5bc5871c8b1ccf24454e1da17d44c52e7c4f43
parent86976e0003cb4a5de01bdadbcde9d9628c243468
Correctly apply penalty bounds on the per-amount penalties

When we attempt to score a channel which has a success probability
very low, we may have a log well above our cut-off of two. For the
liquidity penalties this works great, we bound it by
`NEGATIVE_LOG10_UPPER_BOUND` and `min` the two scores. For the
amount liquidity penalty we didn't do any `min`ing at all.

This fix is to min the log itself first and then reuse the min'd
log in both calculations.
lightning/src/routing/scoring.rs