mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
rpcserver: catch extra err case in LookupInvoice
For a kvdb backed invoices DB, we sometimes will return the ErrNoInviocesCreated error if no invoices have ever been created on the node. In these cases we should still wrap the returned error in the grpc NotFound code.
This commit is contained in:
@@ -6445,7 +6445,9 @@ func (r *rpcServer) LookupInvoice(ctx context.Context,
|
||||
|
||||
invoice, err := r.server.invoices.LookupInvoice(ctx, payHash)
|
||||
switch {
|
||||
case errors.Is(err, invoices.ErrInvoiceNotFound):
|
||||
case errors.Is(err, invoices.ErrInvoiceNotFound) ||
|
||||
errors.Is(err, invoices.ErrNoInvoicesCreated):
|
||||
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user