]> git.bitcoin.ninja Git - rust-lightning/commit
Pass info about claimed payments, incl HTLCs to `ChannelMonitor`s
authorMatt Corallo <git@bluematt.me>
Sun, 15 Sep 2024 23:50:31 +0000 (23:50 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 30 Sep 2024 21:04:08 +0000 (21:04 +0000)
commitf0975648f2b177af96a031ab5714c3f5b0174d4c
treea06d3d3cce300ebef45545f49b111d46def9ba27
parenta8b7f55421a36db6f083c509df30270238ddac35
Pass info about claimed payments, incl HTLCs to `ChannelMonitor`s

When we claim an MPP payment, then crash before persisting all the
relevant `ChannelMonitor`s, we rely on the payment data being
available in the `ChannelManager` on restart to re-claim any parts
that haven't yet been claimed. This is fine as long as the
`ChannelManager` was persisted before the `PaymentClaimable` event
was processed, which is generally the case in our
`lightning-background-processor`, but may not be in other cases or
in a somewhat rare race.

In order to fix this, we need to track where all the MPP parts of
a payment are in the `ChannelMonitor`, allowing us to re-claim any
missing pieces without reference to any `ChannelManager` data.

Further, in order to properly generate a `PaymentClaimed` event
against the re-started claim, we have to store various payment
metadata with the HTLC list as well.

Here we take the first step, building a list of MPP parts and
metadata in `ChannelManager` and passing it through to
`ChannelMonitor` in the `ChannelMonitorUpdate`s.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs