Re-claim forwarded HTLCs on startup
authorMatt Corallo <git@bluematt.me>
Thu, 4 May 2023 21:51:18 +0000 (21:51 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 8 Jul 2023 02:16:33 +0000 (02:16 +0000)
commit345f8df28f359327d80f23cee7cfb3a53d3dd24c
tree5b77d91b431d4a9eab6197800ae538707cdfc0de
parent63217bc9efd1d3fa8cee41cdd1d47ae7f5d311bd
Re-claim forwarded HTLCs on startup

Because `ChannelMonitorUpdate`s can complete asynchronously and
out-of-order now, a `commitment_signed` `ChannelMonitorUpdate` from
a downstream channel could complete prior to the preimage
`ChannelMonitorUpdate` on the upstream channel. In that case, we may
not get a `update_fulfill_htlc` replay on startup. Thus, we have to
ensure any payment preimages contained in that downstream update are
re-claimed on startup.

Here we do this during the existing walk of the `ChannelMonitor`
preimages for closed channels.
lightning/src/ln/channelmanager.rs