Skip to content

Commit ec5dd4b

Browse files
committed
Add RouteBlinding feature flag
The RouteBlinding feature flag is signals support for relaying payments over blinded paths. It is used for paying BOLT 12 invoices, which are required to included at least one blinded path.
1 parent 81d8de7 commit ec5dd4b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lightning/src/ln/features.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
//! and HTLC transactions are pre-signed with zero fee (see
4646
//! [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more
4747
//! information).
48+
//! - `RouteBlinding` - requires/supports that a node can relay payments over blinded paths
49+
//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#route-blinding) for more information).
4850
//! - `ShutdownAnySegwit` - requires/supports that future segwit versions are allowed in `shutdown`
4951
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
5052
//! - `OnionMessages` - requires/supports forwarding onion messages
@@ -128,7 +130,7 @@ mod sealed {
128130
// Byte 2
129131
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
130132
// Byte 3
131-
ShutdownAnySegwit,
133+
RouteBlinding | ShutdownAnySegwit,
132134
// Byte 4
133135
OnionMessages,
134136
// Byte 5
@@ -144,7 +146,7 @@ mod sealed {
144146
// Byte 2
145147
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
146148
// Byte 3
147-
ShutdownAnySegwit,
149+
RouteBlinding | ShutdownAnySegwit,
148150
// Byte 4
149151
OnionMessages,
150152
// Byte 5
@@ -364,6 +366,9 @@ mod sealed {
364366
define_feature!(23, AnchorsZeroFeeHtlcTx, [InitContext, NodeContext, ChannelTypeContext],
365367
"Feature flags for `option_anchors_zero_fee_htlc_tx`.", set_anchors_zero_fee_htlc_tx_optional,
366368
set_anchors_zero_fee_htlc_tx_required, supports_anchors_zero_fee_htlc_tx, requires_anchors_zero_fee_htlc_tx);
369+
define_feature!(25, RouteBlinding, [InitContext, NodeContext],
370+
"Feature flags for `option_route_blinding`.", set_route_blinding_optional,
371+
set_route_blinding_required, supports_route_blinding, requires_route_blinding);
367372
define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
368373
"Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
369374
set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
@@ -841,6 +846,7 @@ mod tests {
841846
init_features.set_basic_mpp_optional();
842847
init_features.set_wumbo_optional();
843848
init_features.set_anchors_zero_fee_htlc_tx_optional();
849+
init_features.set_route_blinding_optional();
844850
init_features.set_shutdown_any_segwit_optional();
845851
init_features.set_onion_messages_optional();
846852
init_features.set_channel_type_optional();
@@ -857,15 +863,15 @@ mod tests {
857863
// - option_data_loss_protect
858864
// - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
859865
// - basic_mpp | wumbo | option_anchors_zero_fee_htlc_tx
860-
// - opt_shutdown_anysegwit
866+
// - option_route_blinding | opt_shutdown_anysegwit
861867
// - onion_messages
862868
// - option_channel_type | option_scid_alias
863869
// - option_zeroconf
864870
assert_eq!(node_features.flags.len(), 7);
865871
assert_eq!(node_features.flags[0], 0b00000010);
866872
assert_eq!(node_features.flags[1], 0b01010001);
867873
assert_eq!(node_features.flags[2], 0b10001010);
868-
assert_eq!(node_features.flags[3], 0b00001000);
874+
assert_eq!(node_features.flags[3], 0b00001010);
869875
assert_eq!(node_features.flags[4], 0b10000000);
870876
assert_eq!(node_features.flags[5], 0b10100000);
871877
assert_eq!(node_features.flags[6], 0b00001000);

0 commit comments

Comments
 (0)