]> git.bitcoin.ninja Git - rust-lightning/commit
Fix channel reserve calculation on the sending side 2021-07-fix-chan-reserve-msat-sat
authorMatt Corallo <git@bluematt.me>
Sun, 4 Jul 2021 14:46:17 +0000 (14:46 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 13 Jul 2021 17:13:58 +0000 (17:13 +0000)
commit306e9a5acf7553b966030cc0ba177d2743675ea5
tree09c60dfc387f0370ca34c320382fb7114c115b86
parentafae12ea1e610634f90335443e3fe9f126bf5551
Fix channel reserve calculation on the sending side

As the variable name implies holder_selected_chan_reserve_msat is
intended to be in millisatoshis, but is instead calculated in
satoshis.

We fix that error here and update the relevant tests to more
accurately calculate the expected reserve value and test both
success and failure cases.

Bug discovered by chanmon_consistency fuzz target.
fuzz/src/chanmon_consistency.rs
lightning/src/ln/channel.rs
lightning/src/ln/functional_tests.rs