Skip to content

Commit 198b040

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 a6c9a95 commit 198b040

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lightning/src/ln/features.rs

+10-4
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
@@ -143,7 +145,7 @@ mod sealed {
143145
// Byte 2
144146
BasicMPP | Wumbo | AnchorsNonzeroFeeHtlcTx | AnchorsZeroFeeHtlcTx,
145147
// Byte 3
146-
ShutdownAnySegwit | Taproot,
148+
RouteBlinding | ShutdownAnySegwit | Taproot,
147149
// Byte 4
148150
OnionMessages,
149151
// Byte 5
@@ -159,7 +161,7 @@ mod sealed {
159161
// Byte 2
160162
BasicMPP | Wumbo | AnchorsNonzeroFeeHtlcTx | AnchorsZeroFeeHtlcTx,
161163
// Byte 3
162-
ShutdownAnySegwit | Taproot,
164+
RouteBlinding | ShutdownAnySegwit | Taproot,
163165
// Byte 4
164166
OnionMessages,
165167
// Byte 5
@@ -391,6 +393,9 @@ mod sealed {
391393
define_feature!(23, AnchorsZeroFeeHtlcTx, [InitContext, NodeContext, ChannelTypeContext],
392394
"Feature flags for `option_anchors_zero_fee_htlc_tx`.", set_anchors_zero_fee_htlc_tx_optional,
393395
set_anchors_zero_fee_htlc_tx_required, supports_anchors_zero_fee_htlc_tx, requires_anchors_zero_fee_htlc_tx);
396+
define_feature!(25, RouteBlinding, [InitContext, NodeContext],
397+
"Feature flags for `option_route_blinding`.", set_route_blinding_optional,
398+
set_route_blinding_required, supports_route_blinding, requires_route_blinding);
394399
define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
395400
"Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
396401
set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
@@ -1017,6 +1022,7 @@ mod tests {
10171022
init_features.set_basic_mpp_optional();
10181023
init_features.set_wumbo_optional();
10191024
init_features.set_anchors_zero_fee_htlc_tx_optional();
1025+
init_features.set_route_blinding_optional();
10201026
init_features.set_shutdown_any_segwit_optional();
10211027
init_features.set_onion_messages_optional();
10221028
init_features.set_channel_type_optional();
@@ -1033,15 +1039,15 @@ mod tests {
10331039
// - option_data_loss_protect (req)
10341040
// - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
10351041
// - basic_mpp | wumbo | option_anchors_zero_fee_htlc_tx
1036-
// - opt_shutdown_anysegwit
1042+
// - option_route_blinding | opt_shutdown_anysegwit
10371043
// - onion_messages
10381044
// - option_channel_type | option_scid_alias
10391045
// - option_zeroconf
10401046
assert_eq!(node_features.flags.len(), 7);
10411047
assert_eq!(node_features.flags[0], 0b00000001);
10421048
assert_eq!(node_features.flags[1], 0b01010001);
10431049
assert_eq!(node_features.flags[2], 0b10001010);
1044-
assert_eq!(node_features.flags[3], 0b00001000);
1050+
assert_eq!(node_features.flags[3], 0b00001010);
10451051
assert_eq!(node_features.flags[4], 0b10000000);
10461052
assert_eq!(node_features.flags[5], 0b10100000);
10471053
assert_eq!(node_features.flags[6], 0b00001000);

0 commit comments

Comments
 (0)