Skip to content

Commit e9315bf

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 d1a5df6 commit e9315bf

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);
@@ -990,6 +995,7 @@ mod tests {
990995
init_features.set_basic_mpp_optional();
991996
init_features.set_wumbo_optional();
992997
init_features.set_anchors_zero_fee_htlc_tx_optional();
998+
init_features.set_route_blinding_optional();
993999
init_features.set_shutdown_any_segwit_optional();
9941000
init_features.set_onion_messages_optional();
9951001
init_features.set_channel_type_optional();
@@ -1006,15 +1012,15 @@ mod tests {
10061012
// - option_data_loss_protect (req)
10071013
// - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
10081014
// - basic_mpp | wumbo | option_anchors_zero_fee_htlc_tx
1009-
// - opt_shutdown_anysegwit
1015+
// - option_route_blinding | opt_shutdown_anysegwit
10101016
// - onion_messages
10111017
// - option_channel_type | option_scid_alias
10121018
// - option_zeroconf
10131019
assert_eq!(node_features.flags.len(), 7);
10141020
assert_eq!(node_features.flags[0], 0b00000001);
10151021
assert_eq!(node_features.flags[1], 0b01010001);
10161022
assert_eq!(node_features.flags[2], 0b10001010);
1017-
assert_eq!(node_features.flags[3], 0b00001000);
1023+
assert_eq!(node_features.flags[3], 0b00001010);
10181024
assert_eq!(node_features.flags[4], 0b10000000);
10191025
assert_eq!(node_features.flags[5], 0b10100000);
10201026
assert_eq!(node_features.flags[6], 0b00001000);

0 commit comments

Comments
 (0)