Skip to content

Commit a32c5cb

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 31ccfb8 commit a32c5cb

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
@@ -136,7 +138,7 @@ mod sealed {
136138
// Byte 2
137139
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
138140
// Byte 3
139-
ShutdownAnySegwit,
141+
RouteBlinding | ShutdownAnySegwit,
140142
// Byte 4
141143
OnionMessages,
142144
// Byte 5
@@ -152,7 +154,7 @@ mod sealed {
152154
// Byte 2
153155
BasicMPP | Wumbo | AnchorsZeroFeeHtlcTx,
154156
// Byte 3
155-
ShutdownAnySegwit,
157+
RouteBlinding | ShutdownAnySegwit,
156158
// Byte 4
157159
OnionMessages,
158160
// Byte 5
@@ -381,6 +383,9 @@ mod sealed {
381383
define_feature!(23, AnchorsZeroFeeHtlcTx, [InitContext, NodeContext, ChannelTypeContext],
382384
"Feature flags for `option_anchors_zero_fee_htlc_tx`.", set_anchors_zero_fee_htlc_tx_optional,
383385
set_anchors_zero_fee_htlc_tx_required, supports_anchors_zero_fee_htlc_tx, requires_anchors_zero_fee_htlc_tx);
386+
define_feature!(25, RouteBlinding, [InitContext, NodeContext],
387+
"Feature flags for `option_route_blinding`.", set_route_blinding_optional,
388+
set_route_blinding_required, supports_route_blinding, requires_route_blinding);
384389
define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
385390
"Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
386391
set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
@@ -882,6 +887,7 @@ mod tests {
882887
init_features.set_basic_mpp_optional();
883888
init_features.set_wumbo_optional();
884889
init_features.set_anchors_zero_fee_htlc_tx_optional();
890+
init_features.set_route_blinding_optional();
885891
init_features.set_shutdown_any_segwit_optional();
886892
init_features.set_onion_messages_optional();
887893
init_features.set_channel_type_optional();
@@ -898,15 +904,15 @@ mod tests {
898904
// - option_data_loss_protect (req)
899905
// - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
900906
// - basic_mpp | wumbo | option_anchors_zero_fee_htlc_tx
901-
// - opt_shutdown_anysegwit
907+
// - option_route_blinding | opt_shutdown_anysegwit
902908
// - onion_messages
903909
// - option_channel_type | option_scid_alias
904910
// - option_zeroconf
905911
assert_eq!(node_features.flags.len(), 7);
906912
assert_eq!(node_features.flags[0], 0b00000001);
907913
assert_eq!(node_features.flags[1], 0b01010001);
908914
assert_eq!(node_features.flags[2], 0b10001010);
909-
assert_eq!(node_features.flags[3], 0b00001000);
915+
assert_eq!(node_features.flags[3], 0b00001010);
910916
assert_eq!(node_features.flags[4], 0b10000000);
911917
assert_eq!(node_features.flags[5], 0b10100000);
912918
assert_eq!(node_features.flags[6], 0b00001000);

0 commit comments

Comments
 (0)