Allow user to opt-in to accepting MPP keysend
authorAlec Chen <alecchendev@gmail.com>
Thu, 20 Apr 2023 21:00:47 +0000 (16:00 -0500)
committerAlec Chen <alecchendev@gmail.com>
Sun, 28 May 2023 03:36:09 +0000 (22:36 -0500)
To support receiving MPP keysends, we will add a new non-backward
compatible field to `PendingHTLCRouting::ReceiveKeysend`, which will
break deserialization of `ChannelManager` on downgrades, so we allow the
user choose whether they want to do this. Note that this commit only
adds the config flag, while full MPP support is added in later commits.

lightning/src/util/config.rs

index 1e678152cccd9d3cfa4bdcc1d40dd441b739913e..fef5338ce6f7973fb14c1f74cb8349502367faf8 100644 (file)
@@ -552,6 +552,17 @@ pub struct UserConfig {
        /// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
        /// [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
        pub accept_intercept_htlcs: bool,
+       /// If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
+       /// parts. If this is set to true, we'll accept the payment.
+       ///
+       /// Setting this to true will break backwards compatibility upon downgrading to an LDK
+       /// version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
+       /// keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
+       ///
+       /// Default value: false.
+       ///
+       /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+       pub accept_mpp_keysend: bool,
 }
 
 impl Default for UserConfig {
@@ -564,6 +575,7 @@ impl Default for UserConfig {
                        accept_inbound_channels: true,
                        manually_accept_inbound_channels: false,
                        accept_intercept_htlcs: false,
+                       accept_mpp_keysend: false,
                }
        }
 }