]> git.bitcoin.ninja Git - rust-lightning/commit
Store + process pending `ChannelMonitorUpdate`s in `Channel` 2023-03-sent-persist-order-prep
authorMatt Corallo <git@bluematt.me>
Fri, 17 Mar 2023 04:55:30 +0000 (04:55 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 2 May 2023 17:59:22 +0000 (17:59 +0000)
commit9dfe42cf8681afc9c3f84e0c85a4e2a30c1156a8
tree5b44b634739caeb671fc9b88cc1db6cfd280fd49
parent756b5aa27862c0999bc96baa46cd93d32823a5f2
Store + process pending `ChannelMonitorUpdate`s in `Channel`

The previous commits set up the ability for us to hold
`ChannelMonitorUpdate`s which are pending until we're ready to pass
them to users and have them be applied. However, if the
`ChannelManager` is persisted while we're waiting to give the user
a `ChannelMonitorUpdate` we'll be confused on restart - seeing our
latest `ChannelMonitor` state as stale compared to our
`ChannelManager` - a critical error.

Luckily the solution is trivial, we simply need to store the
pending `ChannelMonitorUpdate` state and load it with the
`ChannelManager` data, allowing stale monitors on load as long as
we have the missing pending updates between where we are and the
latest `ChannelMonitor` state.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs