Skip to content

Commit af45317

Browse files
committed
record: add func for non-final om route data
Adds the NewNonFinalBlindedRouteDataOnionMessage function to create blinded route data specifically for onion messages.
1 parent 898f975 commit af45317

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

record/blinded_data.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,37 @@ func NewNonFinalBlindedRouteData(chanID lnwire.ShortChannelID,
9090
return info
9191
}
9292

93+
// NewNonFinalBlindedRouteData creates the data that's provided for hops within
94+
// a blinded route.
95+
func NewNonFinalBlindedRouteDataOnionMessage(nextNodeID *btcec.PublicKey,
96+
blindingOverride *btcec.PublicKey, constraints *PaymentConstraints,
97+
features *lnwire.FeatureVector) *BlindedRouteData {
98+
99+
info := &BlindedRouteData{
100+
NextNodeID: tlv.SomeRecordT(
101+
tlv.NewPrimitiveRecord[tlv.TlvType4](nextNodeID),
102+
),
103+
}
104+
105+
if blindingOverride != nil {
106+
info.NextBlindingOverride = tlv.SomeRecordT(
107+
tlv.NewPrimitiveRecord[tlv.TlvType8](blindingOverride))
108+
}
109+
110+
if constraints != nil {
111+
info.Constraints = tlv.SomeRecordT(
112+
tlv.NewRecordT[tlv.TlvType12](*constraints))
113+
}
114+
115+
if features != nil {
116+
info.Features = tlv.SomeRecordT(
117+
tlv.NewRecordT[tlv.TlvType14](*features),
118+
)
119+
}
120+
121+
return info
122+
}
123+
93124
// NewFinalHopBlindedRouteData creates the data that's provided for the final
94125
// hop in a blinded route.
95126
func NewFinalHopBlindedRouteData(constraints *PaymentConstraints,

0 commit comments

Comments
 (0)