Expose a `Balance` for inbound HTLCs even without a preimage
authorMatt Corallo <git@bluematt.me>
Wed, 17 Aug 2022 20:15:23 +0000 (20:15 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 25 Aug 2022 18:51:42 +0000 (18:51 +0000)
commit4c9231371b8496699479e65debfcf342a1a11edd
tree09a817ceecd5d6b9c696831da22364ac8d4c44b1
parentdc54c583de599a274daaab6e88ead0645d2c4c5f
Expose a `Balance` for inbound HTLCs even without a preimage

If we don't currently have the preimage for an inbound HTLC, that
does not guarantee we can never claim it, but instead only that we
cannot claim it unless we receive the preimage from the channel we
forwarded the channel out on.

Thus, we cannot consider a channel to have no claimable balances if
the only remaining output on the commitment ransaction is an
inbound HTLC for which we do not have the preimage, as we may be
able to claim it in the future.

This commit addresses this issue by adding a new `Balance` variant
- `MaybePreimageClaimableHTLCAwaitingTimeout`, which is generated
until the HTLC output is spent.

Fixes #1620
lightning/src/chain/channelmonitor.rs
lightning/src/ln/monitor_tests.rs