]> git.bitcoin.ninja Git - rust-lightning/commit
Don't rely on `calculate_success_probability*` to handle amt > cap
authorMatt Corallo <git@bluematt.me>
Mon, 10 Apr 2023 07:05:31 +0000 (07:05 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 23 Aug 2023 21:15:11 +0000 (21:15 +0000)
commit86976e0003cb4a5de01bdadbcde9d9628c243468
tree3ee291e4bfaed72dc08b9c18fa22cf4fd5ec9da3
parentbada71394e96971bcf29fe997ecc9602ec305da4
Don't rely on `calculate_success_probability*` to handle amt > cap

Currently we let an `htlc_amount >= channel_capacity` pass through
from `penalty_msat` to
`calculate_success_probability_times_billion`, but only if its only
marginally bigger (less than 65/64ths). This is fine as
`calculate_success_probability_times_billion` handles bogus values
just fine (it will always return a zero probability in such cases).

However, this is risky, and in fact breaks in the coming commits,
so instead check it before ever calling through to the historical
bucket probability calculations.
lightning/src/routing/scoring.rs