From 23c3aaac6afe1fbd6103b278d65a3d28f507fa2a Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Thu, 10 Jul 2025 11:15:42 +0200 Subject: [PATCH] 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. --- rpcserver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index 5a8eede0f..e71723e0f 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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