]> git.bitcoin.ninja Git - rust-lightning/commit
Immediately unblock channels on duplicate claims 2023-10-dup-claim-chan-hang
authorMatt Corallo <git@bluematt.me>
Wed, 11 Oct 2023 14:01:28 +0000 (14:01 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 19 Oct 2023 15:27:57 +0000 (15:27 +0000)
commitf47270e760c2f6371d2601ecc4bcf9d24c790926
tree63d9572cf44d7d4116b30754c8f1acff35d25ded
parent9ea90a4a445bde06debcfa291141514055e08c0e
Immediately unblock channels on duplicate claims

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 implement this fix by actually generating the new variant
when a claim is duplicative.
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channelmanager.rs