Guard against division by zero in scorer
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 6 Jan 2023 04:00:31 +0000 (22:00 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 3 Mar 2023 22:25:57 +0000 (16:25 -0600)
commitbfd1a5743427599500360a86ba72eaf4e03b068d
tree3fb234aa96fa3ab20d1d403701cecca02f30b57c
parente44868681dfcb53cafae856e0f798b61e3d90ea8
Guard against division by zero in scorer

Since a node may announce that the htlc_maximum_msat of a channel is
zero, adding one to the denominator in the bucket formulas will prevent
the panic from ever happening. While the routing algorithm may never
select such a channel to score, this precaution may still be useful in
case the algorithm changes or if the scorer is used with a different
routing algorithm.
lightning/src/routing/scoring.rs