]> git.bitcoin.ninja Git - rust-lightning/commit
Pass `EffectiveCapacity` through to scorer instead of a `u64`
authorMatt Corallo <git@bluematt.me>
Thu, 24 Mar 2022 05:52:17 +0000 (05:52 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 24 Mar 2022 17:16:41 +0000 (17:16 +0000)
commit72bc65e16bf6e38224a01318f1ad833341fc359d
tree734a13afef4dc6564ad7918cb3ecdd97f5f4d146
parentf6fa8e9c5baf220da9945ab6ec114404486446f0
Pass `EffectiveCapacity` through to scorer instead of a `u64`

There is little reason to take the `EffectiveCapacity`, which has
a bunch of information about the type of channel, and distill it
down to a `u64` when scoring channels.

Instead, we here pass the full information we know, in the form of
the original `EffectiveCapacity`. This does create more branching
in the main router loop, which appears to have a very slight (1-2%)
performance loss, but that may well be within noise.

Much more importantly, this resolves a panic in our log
approximation where we can accidentally call `log(0)` when the
channel's effective capacity is `u64::max_value()`.
lightning-invoice/src/payment.rs
lightning/src/routing/network_graph.rs
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs