]> git.bitcoin.ninja Git - rust-lightning/commit
Ensure payments don't ever duplicatively fail/succeed on reload
authorMatt Corallo <git@bluematt.me>
Sat, 8 May 2021 22:51:31 +0000 (22:51 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 9 May 2021 00:42:34 +0000 (00:42 +0000)
commitaab121997cf25271cc12ade42bd54bda8846ee7f
tree3598826010e740a2de1ecb7a313845e34efd77de
parentedbbe135a89ed4ab4e2ac7387e72cdcc444eee94
Ensure payments don't ever duplicatively fail/succeed on reload

When a Channel is closed, any outbound HTLCs which were relayed
through it are simply dropped when the Channel is. From there, the
ChannelManager relies on the ChannelMonitor having a copy of the
relevant fail-/claim-back data and processes the HTLC fail/claim
when the ChannelMonitor tells it to.

If, due to an on-chain event, an HTLC is failed/claimed, and then
we serialize the ChannelManager, we generally expect there not to
be a duplicate HTLC fail/claim (eg via a PaymentFailed event
appearing). However, because we may not serialize the relevant
ChannelMonitor at the same time, we may end up getting a
duplicative event, potentially confusing user payment tracking.

In order to provide this consistency, we add explicit tracking of
pending-onchain-resolution outbound HTLCs in the ChannelManager,
using it to de-duplicate ChannelMonitor events.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/routing/router.rs