@@ -477,10 +477,10 @@ type RouteRequest struct {
477477 // in blinded payment.
478478 FinalExpiry uint16
479479
480- // BlindedPayment contains an optional blinded path and parameters
481- // used to reach a target node via a blinded path . This field is
480+ // BlindedPathSet contains a set of optional blinded paths and
481+ // parameters used to reach a target node blinded paths . This field is
482482 // mutually exclusive with the Target field.
483- BlindedPayment * BlindedPayment
483+ BlindedPathSet * BlindedPaymentPathSet
484484}
485485
486486// RouteHints is an alias type for a set of route hints, with the source node
@@ -494,7 +494,7 @@ type RouteHints map[route.Vertex][]AdditionalEdge
494494func NewRouteRequest (source route.Vertex , target * route.Vertex ,
495495 amount lnwire.MilliSatoshi , timePref float64 ,
496496 restrictions * RestrictParams , customRecords record.CustomSet ,
497- routeHints RouteHints , blindedPayment * BlindedPayment ,
497+ routeHints RouteHints , blindedPathSet * BlindedPaymentPathSet ,
498498 finalExpiry uint16 ) (* RouteRequest , error ) {
499499
500500 var (
@@ -504,11 +504,8 @@ func NewRouteRequest(source route.Vertex, target *route.Vertex,
504504 err error
505505 )
506506
507- if blindedPayment != nil {
508- if err := blindedPayment .Validate (); err != nil {
509- return nil , fmt .Errorf ("invalid blinded payment: %w" ,
510- err )
511- }
507+ if blindedPathSet != nil {
508+ blindedPayment := blindedPathSet .GetPath ()
512509
513510 introVertex := route .NewVertex (
514511 blindedPayment .BlindedPath .IntroductionPoint ,
@@ -539,13 +536,13 @@ func NewRouteRequest(source route.Vertex, target *route.Vertex,
539536 requestExpiry = blindedPayment .CltvExpiryDelta
540537 }
541538
542- requestHints , err = blindedPayment . toRouteHints ()
539+ requestHints , err = blindedPathSet . ToRouteHints ()
543540 if err != nil {
544541 return nil , err
545542 }
546543 }
547544
548- requestTarget , err := getTargetNode (target , blindedPayment )
545+ requestTarget , err := getTargetNode (target , blindedPathSet )
549546 if err != nil {
550547 return nil , err
551548 }
@@ -559,15 +556,15 @@ func NewRouteRequest(source route.Vertex, target *route.Vertex,
559556 CustomRecords : customRecords ,
560557 RouteHints : requestHints ,
561558 FinalExpiry : requestExpiry ,
562- BlindedPayment : blindedPayment ,
559+ BlindedPathSet : blindedPathSet ,
563560 }, nil
564561}
565562
566- func getTargetNode (target * route.Vertex , blindedPayment * BlindedPayment ) (
567- route.Vertex , error ) {
563+ func getTargetNode (target * route.Vertex ,
564+ blindedPathSet * BlindedPaymentPathSet ) ( route.Vertex , error ) {
568565
569566 var (
570- blinded = blindedPayment != nil
567+ blinded = blindedPathSet != nil
571568 targetSet = target != nil
572569 )
573570
@@ -576,6 +573,8 @@ func getTargetNode(target *route.Vertex, blindedPayment *BlindedPayment) (
576573 return route.Vertex {}, ErrTargetAndBlinded
577574
578575 case blinded :
576+ blindedPayment := blindedPathSet .GetPath ()
577+
579578 // If we're dealing with an edge-case blinded path that just
580579 // has an introduction node (first hop expected to be the intro
581580 // hop), then we return the unblinded introduction node as our
@@ -597,16 +596,6 @@ func getTargetNode(target *route.Vertex, blindedPayment *BlindedPayment) (
597596 }
598597}
599598
600- // blindedPath returns the request's blinded path, which is set if the payment
601- // is to a blinded route.
602- func (r * RouteRequest ) blindedPath () * sphinx.BlindedPath {
603- if r .BlindedPayment == nil {
604- return nil
605- }
606-
607- return r .BlindedPayment .BlindedPath
608- }
609-
610599// FindRoute attempts to query the ChannelRouter for the optimum path to a
611600// particular target destination to which it is able to send `amt` after
612601// factoring in channel capacities and cumulative fees along the route.
@@ -664,7 +653,7 @@ func (r *ChannelRouter) FindRoute(req *RouteRequest) (*route.Route, float64,
664653 totalAmt : req .Amount ,
665654 cltvDelta : req .FinalExpiry ,
666655 records : req .CustomRecords ,
667- }, req .blindedPath () ,
656+ }, req .BlindedPathSet ,
668657 )
669658 if err != nil {
670659 return nil , 0 , err
@@ -926,14 +915,10 @@ type LightningPayment struct {
926915 // BlindedPayment field.
927916 RouteHints [][]zpay32.HopHint
928917
929- // BlindedPayment holds the information about a blinded path to the
930- // payment recipient. This is mutually exclusive to the RouteHints
918+ // BlindedPathSet holds the information about a set of blinded paths to
919+ // the payment recipient. This is mutually exclusive to the RouteHints
931920 // field.
932- //
933- // NOTE: a recipient may provide multiple blinded payment paths in the
934- // same invoice. Currently, LND will only attempt to use the first one.
935- // A future PR will handle multiple blinded payment paths.
936- BlindedPayment * BlindedPayment
921+ BlindedPathSet * BlindedPaymentPathSet
937922
938923 // OutgoingChannelIDs is the list of channels that are allowed for the
939924 // first hop. If nil, any channel may be used.
0 commit comments