channeldb: add new payment status StatusInitiated
This commit adds a new payment status, `StatusInitiated`, to properly represent the state where a payment is newly created without attempting any HTLCs. Since the `PaymentStatus` is a memory representation of a given payment's status, the enum used for the statuses are directly updated.
This commit is contained in:
1 parent
6be3817eed
commit
30fd29371c
4 files changed
+35
-8
No files matched your search
@@ -446,10 +446,17 @@ func (s *Server) SendToRouteV2(ctx context.Context,
|
||||
}
|
||||
|
||||
// Transform user errors to grpc code.
|
||||
if err == channeldb.ErrPaymentInFlight ||
|
||||
err == channeldb.ErrAlreadyPaid {
|
||||
switch {
|
||||
case errors.Is(err, channeldb.ErrPaymentExists):
|
||||
fallthrough
|
||||
|
||||
return nil, status.Error(codes.AlreadyExists, err.Error())
|
||||
case errors.Is(err, channeldb.ErrPaymentInFlight):
|
||||
fallthrough
|
||||
|
||||
case errors.Is(err, channeldb.ErrAlreadyPaid):
|
||||
return nil, status.Error(
|
||||
codes.AlreadyExists, err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user