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:
Elle Mouton
2025-07-10 11:15:42 +02:00
parent 7a52b6ca5e
commit 23c3aaac6a

View File

@@ -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