mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 23:32:31 +02:00
routerrpc: map errors to grpc status code
The 'payment already exists' case is common in restart scenarios. With this commit it is no longer necessary to string-match on the error message. Implementation is identical to SendPaymentV2.
This commit is contained in:
@@ -375,6 +375,13 @@ func (s *Server) SendToRouteV2(ctx context.Context,
|
||||
return rpcAttempt, nil
|
||||
}
|
||||
|
||||
// Transform user errors to grpc code.
|
||||
if err == channeldb.ErrPaymentInFlight ||
|
||||
err == channeldb.ErrAlreadyPaid {
|
||||
|
||||
return nil, status.Error(codes.AlreadyExists, err.Error())
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user