rpcserver: adds NOT_FOUND status code for LookupInvoice

This commit is contained in:
github2k20 2021-09-20 14:04:26 +05:30
parent 7970ffcc2a
commit 2e4318b0ad

View file

@ -5080,7 +5080,10 @@ func (r *rpcServer) LookupInvoice(ctx context.Context,
rpcsLog.Tracef("[lookupinvoice] searching for invoice %x", payHash[:])
invoice, err := r.server.invoices.LookupInvoice(payHash)
if err != nil {
switch {
case err == channeldb.ErrInvoiceNotFound:
return nil, status.Error(codes.NotFound, err.Error())
case err != nil:
return nil, err
}