@@ -183,6 +183,43 @@ pub struct ChannelHandshakeConfig {
183183 /// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
184184 pub negotiate_anchors_zero_fee_htlc_tx : bool ,
185185
186+ /// If set, we attempt to negotiate the `zero_fee_commitments` option for all future channels.
187+ ///
188+ /// These channels operate very similarly to the `anchors_zero_fee_htlc` channels but rely on
189+ /// [TRUC] to assign zero fee to the commitment transactions themselves, avoiding many protocol
190+ /// edge-cases involving fee updates and greatly simplifying the concept of your "balance" in
191+ /// lightning.
192+ ///
193+ /// Like `anchors_zero_fee_htlc` channels, this feature requires having a reserve of onchain
194+ /// funds readily available to bump transactions in the event of a channel force close to avoid
195+ /// the possibility of losing funds.
196+ ///
197+ /// Note that if you wish accept inbound channels with anchor outputs, you must enable
198+ /// [`UserConfig::manually_accept_inbound_channels`] and manually accept them with
199+ /// [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check
200+ /// whether your reserve of onchain funds is enough to cover the fees for all existing and new
201+ /// channels featuring anchor outputs in the event of a force close.
202+ ///
203+ /// If this option is set, channels may be created that will not be readable by LDK versions
204+ /// prior to 0.2, causing [`ChannelManager`]'s read method to return a
205+ /// [`DecodeError::InvalidValue`].
206+ ///
207+ /// Note that setting this to true does *not* prevent us from opening channels with
208+ /// counterparties that do not support the `zero_fee_commitments` option; we will simply fall
209+ /// back to a `anchors_zero_fee_htlc` (if [`Self::negotiate_anchors_zero_fee_htlc_tx`]
210+ /// is set) or `static_remote_key` channel.
211+ ///
212+ /// *Implies [`Self::negotiate_anchors_zero_fee_htlc_tx`].*
213+ ///
214+ /// Default value: `false` (This value is likely to change to `true` in the future.)
215+ ///
216+ /// [TRUC]: (https://bitcoinops.org/en/topics/version-3-transaction-relay/)
217+ /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
218+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
219+ /// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
220+ #[ cfg( test) ]
221+ pub negotiate_anchor_zero_fee_commitments : bool ,
222+
186223 /// The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
187224 ///
188225 /// Increasing the value can help improve liquidity and stability in
@@ -212,6 +249,8 @@ impl Default for ChannelHandshakeConfig {
212249 commit_upfront_shutdown_pubkey : true ,
213250 their_channel_reserve_proportional_millionths : 10_000 ,
214251 negotiate_anchors_zero_fee_htlc_tx : false ,
252+ #[ cfg( test) ]
253+ negotiate_anchor_zero_fee_commitments : false ,
215254 our_max_accepted_htlcs : 50 ,
216255 }
217256 }
@@ -233,6 +272,8 @@ impl Readable for ChannelHandshakeConfig {
233272 commit_upfront_shutdown_pubkey : Readable :: read ( reader) ?,
234273 their_channel_reserve_proportional_millionths : Readable :: read ( reader) ?,
235274 negotiate_anchors_zero_fee_htlc_tx : Readable :: read ( reader) ?,
275+ #[ cfg( test) ]
276+ negotiate_anchor_zero_fee_commitments : Readable :: read ( reader) ?,
236277 our_max_accepted_htlcs : Readable :: read ( reader) ?,
237278 } )
238279 }
0 commit comments