@@ -509,6 +509,10 @@ func (s *Server) probeDestination(dest []byte, amtSat int64) (*RouteFeeResponse,
509
509
// node. If the route hints don't indicate an LSP, they are passed as arguments
510
510
// to the SendPayment_V2 method, which enable it to send probe payments to the
511
511
// 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).
512
516
func (s * Server ) probePaymentRequest (ctx context.Context , paymentRequest string ,
513
517
timeout uint32 ) (* RouteFeeResponse , error ) {
514
518
@@ -558,6 +562,9 @@ func (s *Server) probePaymentRequest(ctx context.Context, paymentRequest string,
558
562
// payment won't be blocked along the route to the destination. We send
559
563
// a probe payment with unmodified route hints.
560
564
if ! isLSP (hints , s .cfg .RouterBackend .FetchChannelEndpoints ) {
565
+ log .Infof ("No LSP detected, probing destination %x" ,
566
+ probeRequest .Dest )
567
+
561
568
probeRequest .RouteHints = invoicesrpc .CreateRPCRouteHints (hints )
562
569
return s .sendProbePayment (ctx , probeRequest )
563
570
}
@@ -571,9 +578,14 @@ func (s *Server) probePaymentRequest(ctx context.Context, paymentRequest string,
571
578
return nil , err
572
579
}
573
580
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
+
574
587
// The adjusted route hints serve the payment probe to find the last
575
588
// public hop to the LSP on the route.
576
- probeRequest .Dest = lspHint .NodeID .SerializeCompressed ()
577
589
if len (lspAdjustedRouteHints ) > 0 {
578
590
probeRequest .RouteHints = invoicesrpc .CreateRPCRouteHints (
579
591
lspAdjustedRouteHints ,
@@ -609,7 +621,8 @@ func (s *Server) probePaymentRequest(ctx context.Context, paymentRequest string,
609
621
// Dispatch the payment probe with adjusted fee amount.
610
622
resp , err := s .sendProbePayment (ctx , probeRequest )
611
623
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 )
613
626
}
614
627
615
628
// If the payment probe failed we only return the failure reason and
@@ -667,11 +680,11 @@ func isLSP(routeHints [][]zpay32.HopHint,
667
680
return false
668
681
}
669
682
670
- idMatchesRefNode := bytes .Equal (
683
+ matchesDestNode := bytes .Equal (
671
684
lastHop .NodeID .SerializeCompressed (),
672
685
destHopHint .NodeID .SerializeCompressed (),
673
686
)
674
- if ! idMatchesRefNode {
687
+ if ! matchesDestNode {
675
688
return false
676
689
}
677
690
}
0 commit comments