]> git.bitcoin.ninja Git - rust-lightning/commit
Fail HTLCs which were removed from a channel but not persisted 2022-11-reload-htlc
authorMatt Corallo <git@bluematt.me>
Wed, 16 Nov 2022 02:20:03 +0000 (02:20 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 5 Dec 2022 20:27:35 +0000 (20:27 +0000)
commitdbe4aadb8958b20aac0225cb17c7faa3fab31386
tree6bc090d18d916b257008efa8ea42745be88f7497
parent0bb87ddad71d2e33199ebad79e9f709f869f2130
Fail HTLCs which were removed from a channel but not persisted

When a channel is force-closed, if a `ChannelMonitor` update is
completed but a `ChannelManager` persist has not yet happened,
HTLCs which were removed in the latest (persisted) `ChannelMonitor`
update will not be failed even though they do not appear in the
commitment transaction which went on chain. This is because the
`ChannelManager` thinks the `ChannelMonitor` is responsible for
them (as it is stale), but the `ChannelMonitor` has no knowledge of
the HTLC at all (as it is not stale).

The fix for this is relatively simple - we need to check for this
specific case and fail back such HTLCs when deserializing a
`ChannelManager`
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/reload_tests.rs