Add an immediately-freeing `MonitorUpdateCompletionAction`.
authorMatt Corallo <git@bluematt.me>
Wed, 11 Oct 2023 13:56:00 +0000 (13:56 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 19 Oct 2023 15:27:57 +0000 (15:27 +0000)
commit9ea90a4a445bde06debcfa291141514055e08c0e
tree39bfa1f0c719bcc1f741e86ed5a8c559e014b8c3
parent6d85be27d4f499d18f3626d457f91c9e0ca5ff16
Add an immediately-freeing `MonitorUpdateCompletionAction`.

When `MonitorUpdateCompletionAction`s were added, we didn't
consider the case of a duplicate claim during normal HTLC
processing (as the handling only had an `if let` rather than a
`match`, which made the branch easy to miss). This can lead to a
channel freezing indefinitely if an HTLC is claimed (without a
`commitment_signed`), the peer disconnects, and then the HTLC is
claimed again, leading to a never-completing
`MonitorUpdateCompletionAction`.

The fix is simple - if we get back an
`UpdateFulfillCommitFetch::DuplicateClaim` when claiming from the
inbound edge, immediately unlock the outbound edge channel with a
new `MonitorUpdateCompletionAction::FreeOtherChannelImmediately`.

Here we add the new variant, which we start generating in the next
commit.
lightning/src/ln/channelmanager.rs