routing+routerrpc+channeldb: return route on invalid payment details

This commit is contained in:
Joost Jager committed 2019-07-04 09:27:16 +02:00
1 parent 7bc56f5a7b
commit 5ce04091d8
4 files changed
+55 -15

No files matched your search

+9 -2
View File
@@ -499,8 +499,10 @@ func (s *Server) TrackPayment(request *TrackPaymentRequest,
func (s *Server) trackPayment(paymentHash lntypes.Hash,
stream Router_TrackPaymentServer) error {
router := s.cfg.RouterBackend
// Subscribe to the outcome of this payment.
inFlight, resultChan, err := s.cfg.RouterBackend.Tower.SubscribePayment(
inFlight, resultChan, err := router.Tower.SubscribePayment(
paymentHash,
)
switch {
@@ -535,7 +537,7 @@ func (s *Server) trackPayment(paymentHash lntypes.Hash,
status.State = PaymentState_SUCCEEDED
status.Preimage = result.Preimage[:]
status.Route = s.cfg.RouterBackend.MarshallRoute(
status.Route = router.MarshallRoute(
result.Route,
)
} else {
@@ -546,6 +548,11 @@ func (s *Server) trackPayment(paymentHash lntypes.Hash,
return err
}
status.State = state
if result.Route != nil {
status.Route = router.MarshallRoute(
result.Route,
)
}
}
// Send event to the client.