Skip to content

Commit f3d433b

Browse files
committed
Define option_anchors_zero_fee_htlc_tx feature bit
1 parent 35affd4 commit f3d433b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lightning/src/ln/channelmanager.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6559,6 +6559,7 @@ pub fn provided_init_features() -> InitFeatures {
65596559
features.set_channel_type_optional();
65606560
features.set_scid_privacy_optional();
65616561
features.set_zero_conf_optional();
6562+
features.set_anchors_zero_fee_htlc_tx_optional();
65626563
features
65636564
}
65646565

lightning/src/ln/features.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
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
56+
//! and HTLC transactions are pre-signed with zero fee (see
57+
//! [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more
58+
//! information).
5559
//!
5660
//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md
5761
//! [messages]: crate::ln::msgs
@@ -122,7 +126,7 @@ mod sealed {
122126
// Byte 1
123127
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
124128
// Byte 2
125-
BasicMPP | Wumbo,
129+
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
126130
// Byte 3
127131
ShutdownAnySegwit,
128132
// Byte 4
@@ -138,7 +142,7 @@ mod sealed {
138142
// Byte 1
139143
VariableLengthOnion | StaticRemoteKey | PaymentSecret,
140144
// Byte 2
141-
BasicMPP | Wumbo,
145+
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
142146
// Byte 3
143147
ShutdownAnySegwit,
144148
// Byte 4
@@ -167,7 +171,7 @@ mod sealed {
167171
// Byte 1
168172
StaticRemoteKey,
169173
// Byte 2
170-
,
174+
AnchorsZeroFeeHtlcTx,
171175
// Byte 3
172176
,
173177
// Byte 4
@@ -348,6 +352,9 @@ mod sealed {
348352
define_feature!(19, Wumbo, [InitContext, NodeContext],
349353
"Feature flags for `option_support_large_channel` (aka wumbo channels).", set_wumbo_optional, set_wumbo_required,
350354
supports_wumbo, requires_wumbo);
355+
define_feature!(23, AnchorsZeroFeeHtlcTx, [InitContext, NodeContext, ChannelTypeContext],
356+
"Feature flags for `option_anchors_zero_fee_htlc_tx`.", set_anchors_zero_fee_htlc_tx_optional,
357+
set_anchors_zero_fee_htlc_tx_required, supports_anchors_zero_fee_htlc_tx, requires_anchors_zero_fee_htlc_tx);
351358
define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
352359
"Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
353360
set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
@@ -798,7 +805,7 @@ mod tests {
798805
assert_eq!(node_features.flags.len(), 7);
799806
assert_eq!(node_features.flags[0], 0b00000010);
800807
assert_eq!(node_features.flags[1], 0b01010001);
801-
assert_eq!(node_features.flags[2], 0b00001010);
808+
assert_eq!(node_features.flags[2], 0b10001010);
802809
assert_eq!(node_features.flags[3], 0b00001000);
803810
assert_eq!(node_features.flags[4], 0b10000000);
804811
assert_eq!(node_features.flags[5], 0b10100000);

0 commit comments

Comments
 (0)