@@ -509,6 +509,10 @@ func (s *Server) probeDestination(dest []byte, amtSat int64) (*RouteFeeResponse,
509509// node. If the route hints don't indicate an LSP, they are passed as arguments
510510// to the SendPayment_V2 method, which enable it to send probe payments to the
511511// payment request destination.
512+ //
513+ // NOTE: Be aware that because of the special heuristic that is applied to
514+ // identify LSPs, the probe payment might use a different node id as the
515+ // final destination (the assumed LSP node id).
512516func (s * Server ) probePaymentRequest (ctx context.Context , paymentRequest string ,
513517 timeout uint32 ) (* RouteFeeResponse , error ) {
514518
@@ -558,6 +562,9 @@ func (s *Server) probePaymentRequest(ctx context.Context, paymentRequest string,
558562 // payment won't be blocked along the route to the destination. We send
559563 // a probe payment with unmodified route hints.
560564 if ! isLSP (hints , s .cfg .RouterBackend .FetchChannelEndpoints ) {
565+ log .Infof ("No LSP detected, probing destination %x" ,
566+ probeRequest .Dest )
567+
561568 probeRequest .RouteHints = invoicesrpc .CreateRPCRouteHints (hints )
562569 return s .sendProbePayment (ctx , probeRequest )
563570 }
@@ -571,9 +578,14 @@ func (s *Server) probePaymentRequest(ctx context.Context, paymentRequest string,
571578 return nil , err
572579 }
573580
581+ // Set the destination to the LSP node ID.
582+ lspDest := lspHint .NodeID .SerializeCompressed ()
583+ probeRequest .Dest = lspDest
584+
585+ log .Infof ("LSP detected, probing LSP with destination: %x" , lspDest )
586+
574587 // The adjusted route hints serve the payment probe to find the last
575588 // public hop to the LSP on the route.
576- probeRequest .Dest = lspHint .NodeID .SerializeCompressed ()
577589 if len (lspAdjustedRouteHints ) > 0 {
578590 probeRequest .RouteHints = invoicesrpc .CreateRPCRouteHints (
579591 lspAdjustedRouteHints ,
@@ -609,7 +621,8 @@ func (s *Server) probePaymentRequest(ctx context.Context, paymentRequest string,
609621 // Dispatch the payment probe with adjusted fee amount.
610622 resp , err := s .sendProbePayment (ctx , probeRequest )
611623 if err != nil {
612- return nil , err
624+ return nil , fmt .Errorf ("failed to send probe payment to " +
625+ "LSP with destination %x: %w" , lspDest , err )
613626 }
614627
615628 // If the payment probe failed we only return the failure reason and
@@ -667,11 +680,11 @@ func isLSP(routeHints [][]zpay32.HopHint,
667680 return false
668681 }
669682
670- idMatchesRefNode := bytes .Equal (
683+ matchesDestNode := bytes .Equal (
671684 lastHop .NodeID .SerializeCompressed (),
672685 destHopHint .NodeID .SerializeCompressed (),
673686 )
674- if ! idMatchesRefNode {
687+ if ! matchesDestNode {
675688 return false
676689 }
677690 }
0 commit comments