Add a few notes about deserializing stale ChannelManagers
authorMatt Corallo <git@bluematt.me>
Wed, 3 Feb 2021 20:13:06 +0000 (15:13 -0500)
committerMatt Corallo <git@bluematt.me>
Wed, 3 Mar 2021 01:40:29 +0000 (20:40 -0500)
See diff for more details

lightning/src/ln/channelmanager.rs

index b56ce5d9d052aa38c955d172e498d6cde4260713..893cb4b32fd8dc4f7814ccfb64557e9f28f1576a 100644 (file)
@@ -3934,6 +3934,13 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
 /// 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, Signer: 'a + Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
        where M::Target: chain::Watch<Signer>,
         T::Target: BroadcasterInterface,