Skip to content

Commit a46e19d

Browse files
committed
Define option_anchors_zero_fee_htlc_tx feature bit
1 parent 5a257d0 commit a46e19d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6248,6 +6248,7 @@ pub fn provided_init_features() -> InitFeatures {
62486248
features.set_channel_type_optional();
62496249
features.set_scid_privacy_optional();
62506250
features.set_zero_conf_optional();
6251+
features.set_anchors_zero_fee_htlc_tx_optional();
62516252
features
62526253
}
62536254

lightning/src/ln/features.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
5353
//! - `Keysend` - send funds to a node without an invoice
5454
//! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information).
55+
//! - `AnchorsZeroFeeHtlcTx` - requires/supports that commitment transactions include anchor outputs and HTLC transactions have zero fee
56+
//! (see [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more information).
5557
//!
5658
//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md
5759
//! [messages]: crate::ln::msgs
@@ -122,7 +124,7 @@ mod sealed {
122124
// Byte 1
123125
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
124126
// Byte 2
125-
BasicMPP | Wumbo,
127+
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
126128
// Byte 3
127129
ShutdownAnySegwit,
128130
// Byte 4
@@ -138,7 +140,7 @@ mod sealed {
138140
// Byte 1
139141
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
140142
// Byte 2
141-
BasicMPP | Wumbo,
143+
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
142144
// Byte 3
143145
ShutdownAnySegwit,
144146
// Byte 4
@@ -165,7 +167,7 @@ mod sealed {
165167
// Byte 1
166168
StaticRemoteKey,
167169
// Byte 2
168-
,
170+
AnchorsZeroFeeHtlcTx,
169171
// Byte 3
170172
,
171173
// Byte 4
@@ -346,6 +348,9 @@ mod sealed {
346348
define_feature!(19, Wumbo, [InitContext, NodeContext],
347349
"Feature flags for `option_support_large_channel` (aka wumbo channels).", set_wumbo_optional, set_wumbo_required,
348350
supports_wumbo, requires_wumbo);
351+
define_feature!(23, AnchorsZeroFeeHtlcTx, [InitContext, NodeContext, ChannelTypeContext],
352+
"Feature flags for `option_anchors_zero_fee_htlc_tx`.", set_anchors_zero_fee_htlc_tx_optional,
353+
set_anchors_zero_fee_htlc_tx_required, supports_anchors_zero_fee_htlc_tx, requires_anchors_zero_fee_htlc_tx);
349354
define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
350355
"Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
351356
set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
@@ -776,7 +781,7 @@ mod tests {
776781
assert_eq!(node_features.flags.len(), 7);
777782
assert_eq!(node_features.flags[0], 0b00000010);
778783
assert_eq!(node_features.flags[1], 0b01010001);
779-
assert_eq!(node_features.flags[2], 0b00001010);
784+
assert_eq!(node_features.flags[2], 0b10001010);
780785
assert_eq!(node_features.flags[3], 0b00001000);
781786
assert_eq!(node_features.flags[4], 0b10000000);
782787
assert_eq!(node_features.flags[5], 0b10100000);

0 commit comments

Comments
 (0)