Skip to content

Commit eaa8592

Browse files
committed
multi: enable optional route blinding feature
1 parent 75d4a4c commit eaa8592

File tree

10 files changed

+383
-333
lines changed

10 files changed

+383
-333
lines changed

feature/default_sets.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ var defaultSetDesc = setDesc{
7979
SetInit: {}, // I
8080
SetNodeAnn: {}, // N
8181
},
82+
lnwire.RouteBlindingOptional: {
83+
SetInit: {}, // I
84+
SetNodeAnn: {}, // N
85+
SetInvoice: {}, // 9
86+
},
8287
lnwire.ShutdownAnySegwitOptional: {
8388
SetInit: {}, // I
8489
SetNodeAnn: {}, // N

feature/deps.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ var deps = depDesc{
7979
lnwire.AnchorsZeroFeeHtlcTxOptional: {},
8080
lnwire.ExplicitChannelTypeOptional: {},
8181
},
82+
lnwire.RouteBlindingOptional: {
83+
lnwire.TLVOnionPayloadOptional: {},
84+
},
85+
lnwire.RouteBlindingRequired: {
86+
lnwire.TLVOnionPayloadRequired: {},
87+
},
8288
}
8389

8490
// ValidateDeps asserts that a feature vector sets all features and their

feature/manager.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ type Config struct {
6060
// segwit witness versions for co-op closes.
6161
NoAnySegwit bool
6262

63+
// NoRouteBlinding unsets route blinding feature bits.
64+
NoRouteBlinding bool
65+
6366
// CustomFeatures is a set of custom features to advertise in each
6467
// set.
6568
CustomFeatures map[Set][]lnwire.FeatureBit
@@ -123,6 +126,8 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
123126
raw.Unset(lnwire.PaymentAddrRequired)
124127
raw.Unset(lnwire.MPPOptional)
125128
raw.Unset(lnwire.MPPRequired)
129+
raw.Unset(lnwire.RouteBlindingOptional)
130+
raw.Unset(lnwire.RouteBlindingRequired)
126131
raw.Unset(lnwire.AMPOptional)
127132
raw.Unset(lnwire.AMPRequired)
128133
raw.Unset(lnwire.KeysendOptional)
@@ -179,7 +184,10 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
179184
raw.Unset(lnwire.SimpleTaprootChannelsOptionalStaging)
180185
raw.Unset(lnwire.SimpleTaprootChannelsRequiredStaging)
181186
}
182-
187+
if cfg.NoRouteBlinding {
188+
raw.Unset(lnwire.RouteBlindingOptional)
189+
raw.Unset(lnwire.RouteBlindingRequired)
190+
}
183191
for _, custom := range cfg.CustomFeatures[set] {
184192
if custom > set.Maximum() {
185193
return nil, fmt.Errorf("feature bit: %v "+

lnrpc/lightning.pb.go

Lines changed: 342 additions & 332 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lnrpc/lightning.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4311,6 +4311,8 @@ enum FeatureBit {
43114311
ANCHORS_OPT = 21;
43124312
ANCHORS_ZERO_FEE_HTLC_REQ = 22;
43134313
ANCHORS_ZERO_FEE_HTLC_OPT = 23;
4314+
ROUTE_BLINDING_REQUIRED = 24;
4315+
ROUTE_BLINDING_OPTIONAL = 25;
43144316
AMP_REQ = 30;
43154317
AMP_OPT = 31;
43164318
}

lnrpc/lightning.swagger.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,8 @@
14701470
"ANCHORS_OPT",
14711471
"ANCHORS_ZERO_FEE_HTLC_REQ",
14721472
"ANCHORS_ZERO_FEE_HTLC_OPT",
1473+
"ROUTE_BLINDING_REQUIRED",
1474+
"ROUTE_BLINDING_OPTIONAL",
14731475
"AMP_REQ",
14741476
"AMP_OPT"
14751477
]
@@ -4694,6 +4696,8 @@
46944696
"ANCHORS_OPT",
46954697
"ANCHORS_ZERO_FEE_HTLC_REQ",
46964698
"ANCHORS_ZERO_FEE_HTLC_OPT",
4699+
"ROUTE_BLINDING_REQUIRED",
4700+
"ROUTE_BLINDING_OPTIONAL",
46974701
"AMP_REQ",
46984702
"AMP_OPT"
46994703
],

lnrpc/peersrpc/peers.swagger.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"ANCHORS_OPT",
7878
"ANCHORS_ZERO_FEE_HTLC_REQ",
7979
"ANCHORS_ZERO_FEE_HTLC_OPT",
80+
"ROUTE_BLINDING_REQUIRED",
81+
"ROUTE_BLINDING_OPTIONAL",
8082
"AMP_REQ",
8183
"AMP_OPT"
8284
],

lnrpc/routerrpc/router.swagger.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@
772772
"ANCHORS_OPT",
773773
"ANCHORS_ZERO_FEE_HTLC_REQ",
774774
"ANCHORS_ZERO_FEE_HTLC_OPT",
775+
"ROUTE_BLINDING_REQUIRED",
776+
"ROUTE_BLINDING_OPTIONAL",
775777
"AMP_REQ",
776778
"AMP_OPT"
777779
],

lnwire/features.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ const (
141141
// transactions, which also imply anchor commitments.
142142
AnchorsZeroFeeHtlcTxOptional FeatureBit = 23
143143

144+
// RouteBlindingRequired is a required feature bit that signals that
145+
// the node supports blinded payments.
146+
RouteBlindingRequired FeatureBit = 24
147+
148+
// RouteBlindingOptional is an optional feature bit that signals that
149+
// the node supports blinded payments.
150+
RouteBlindingOptional FeatureBit = 25
151+
144152
// ShutdownAnySegwitRequired is an required feature bit that signals
145153
// that the sender is able to properly handle/parse segwit witness
146154
// programs up to version 16. This enables utilization of Taproot
@@ -315,6 +323,8 @@ var Features = map[FeatureBit]string{
315323
ScidAliasOptional: "scid-alias",
316324
ZeroConfRequired: "zero-conf",
317325
ZeroConfOptional: "zero-conf",
326+
RouteBlindingRequired: "route-blinding",
327+
RouteBlindingOptional: "route-blinding",
318328
ShutdownAnySegwitRequired: "shutdown-any-segwit",
319329
ShutdownAnySegwitOptional: "shutdown-any-segwit",
320330
SimpleTaprootChannelsRequiredFinal: "simple-taproot-chans",

server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
549549
NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(),
550550
CustomFeatures: cfg.ProtocolOptions.ExperimentalProtocol.CustomFeatures(),
551551
NoTaprootChans: !cfg.ProtocolOptions.TaprootChans,
552+
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
552553
})
553554
if err != nil {
554555
return nil, err

0 commit comments

Comments
 (0)