Stop including dust values in feerate affordability checks
authorMatt Corallo <git@bluematt.me>
Sun, 24 Dec 2023 05:17:29 +0000 (05:17 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 29 Dec 2023 06:24:18 +0000 (06:24 +0000)
commitddb54fc2d2f539502ab36357470f8a9a9d9555f1
tree67af8331f0315075a8c91dfb45fd71f5960799a1
parentdf1f981627a9daa97b5e3b06bc90666206245309
Stop including dust values in feerate affordability checks

When we or our counterparty are updating the fees on the channel,
we currently check that the resulting balance is sufficient not
only to meet the reserve threshold, but also not push it below
dust. This isn't required in the BOLTs and may lead to spurious
force-closures (which would be a bit safer, but reserve should
always exceed the dust threshold).

Worse, the current logic is broken - it compares the output value
in *billionths of satoshis* to the dust limit in satoshis. Thus,
the code is borderline dead anyway, but can overflow for channels
with several million Bitcoin, causing the fuzzer to get mad (and
lead to spurious force-closures for few-billion-dollar channels).
lightning/src/ln/channel.rs