@@ -183,6 +183,41 @@ pub struct ChannelHandshakeConfig {
183
183
/// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
184
184
pub negotiate_anchors_zero_fee_htlc_tx : bool ,
185
185
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
+ /// Default value: `false` (This value is likely to change to `true` in the future.)
213
+ ///
214
+ /// [TRUC]: (https://bitcoinops.org/en/topics/version-3-transaction-relay/)
215
+ /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
216
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
217
+ /// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
218
+ #[ cfg( test) ]
219
+ pub negotiate_anchor_zero_fee_commitments : bool ,
220
+
186
221
/// The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
187
222
///
188
223
/// Increasing the value can help improve liquidity and stability in
@@ -212,6 +247,8 @@ impl Default for ChannelHandshakeConfig {
212
247
commit_upfront_shutdown_pubkey : true ,
213
248
their_channel_reserve_proportional_millionths : 10_000 ,
214
249
negotiate_anchors_zero_fee_htlc_tx : false ,
250
+ #[ cfg( test) ]
251
+ negotiate_anchor_zero_fee_commitments : false ,
215
252
our_max_accepted_htlcs : 50 ,
216
253
}
217
254
}
@@ -233,6 +270,8 @@ impl Readable for ChannelHandshakeConfig {
233
270
commit_upfront_shutdown_pubkey : Readable :: read ( reader) ?,
234
271
their_channel_reserve_proportional_millionths : Readable :: read ( reader) ?,
235
272
negotiate_anchors_zero_fee_htlc_tx : Readable :: read ( reader) ?,
273
+ #[ cfg( test) ]
274
+ negotiate_anchor_zero_fee_commitments : Readable :: read ( reader) ?,
236
275
our_max_accepted_htlcs : Readable :: read ( reader) ?,
237
276
} )
238
277
}
0 commit comments