Fix shift overflow in Scorer::channel_penalty_msat
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 1 Dec 2021 04:57:32 +0000 (22:57 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 3 Dec 2021 20:00:52 +0000 (14:00 -0600)
commit857b4c08a5870025a3aeb5e606972ef375d4bbea
treee5b9a67283be257fd5f3d3b6e7e06089c787d17f
parentd28d6a5403682d2d1539bf73552a4490a2309578
Fix shift overflow in Scorer::channel_penalty_msat

An unchecked shift of more than 64 bits on u64 values causes a shift
overflow panic. This may happen if a channel is penalized only once and
(1) is not successfully routed through and (2) after 64 or more half
life decays. Use a checked shift to prevent this from happening.
lightning/src/routing/scoring.rs