Reject channels if the total reserves are larger than the funding
authorMatt Corallo <git@bluematt.me>
Thu, 28 Apr 2022 19:46:13 +0000 (19:46 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 28 Apr 2022 19:46:13 +0000 (19:46 +0000)
commit2826af75a5761859dedcddc870de0753ae4ecde4
treed83dff5e221d670ac09f92d791c22cd6a94bcd88
parentd1b984d8648aae56454bc4cf57c3119511b42886
Reject channels if the total reserves are larger than the funding

The `full_stack_target` fuzzer managed to find a subtraction
underflow in the new `Channel::get_htlc_maximum` function where we
subtract both sides' reserve values from the channel funding. Such
a channel is obviously completely useless, so we should reject it
during opening instead of integer-underflowing later.

Thanks to Chaincode Labs for providing the fuzzing resources which
found this bug!
lightning/src/ln/channel.rs