From: Matt Corallo Date: Wed, 3 Feb 2021 20:13:06 +0000 (-0500) Subject: Add a few notes about deserializing stale ChannelManagers X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=f6c60d7fd88188517c89931de20afe14de979a91;p=rust-lightning Add a few notes about deserializing stale ChannelManagers See diff for more details --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 3dcc74f90..7d071c340 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -3790,6 +3790,13 @@ impl /// 4) Reconnect blocks on your ChannelMonitors. /// 5) Move the ChannelMonitors into your local chain::Watch. /// 6) Disconnect/connect blocks on the ChannelManager. +/// +/// Note that because some channels may be closed during deserialization, it is critical that you +/// always deserialize only the latest version of a ChannelManager and ChannelMonitors available to +/// you. If you deserialize an old ChannelManager (during which force-closure transactions may be +/// broadcast), and then later deserialize a newer version of the same ChannelManager (which will +/// not force-close the same channels but consider them live), you may end up revoking a state for +/// which you've already broadcasted the transaction. pub struct ChannelManagerReadArgs<'a, ChanSigner: 'a + ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> where M::Target: chain::Watch, T::Target: BroadcasterInterface,