From 2611d48b77fa5be131851582cc3bfa6dfcc6f725 Mon Sep 17 00:00:00 2001 From: Kevin Davis Date: Mon, 15 Mar 2021 08:41:36 -0600 Subject: [PATCH] fix: return nil instead of empty byte slice (#878) --- x/pricefeed/keeper/querier.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/pricefeed/keeper/querier.go b/x/pricefeed/keeper/querier.go index db610e23..112444ea 100644 --- a/x/pricefeed/keeper/querier.go +++ b/x/pricefeed/keeper/querier.go @@ -41,7 +41,7 @@ func queryPrice(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) (res []by } _, found := keeper.GetMarket(ctx, requestParams.MarketID) if !found { - return []byte{}, sdkerrors.Wrap(types.ErrAssetNotFound, requestParams.MarketID) + return nil, sdkerrors.Wrap(types.ErrAssetNotFound, requestParams.MarketID) } currentPrice, sdkErr := keeper.GetCurrentPrice(ctx, requestParams.MarketID) if sdkErr != nil { @@ -72,7 +72,7 @@ func queryRawPrices(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) (res } _, found := keeper.GetMarket(ctx, requestParams.MarketID) if !found { - return []byte{}, sdkerrors.Wrap(types.ErrAssetNotFound, requestParams.MarketID) + return nil, sdkerrors.Wrap(types.ErrAssetNotFound, requestParams.MarketID) } rawPrices, err := keeper.GetRawPrices(ctx, requestParams.MarketID) @@ -97,7 +97,7 @@ func queryOracles(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) (res [] oracles, err := keeper.GetOracles(ctx, requestParams.MarketID) if err != nil { - return []byte{}, sdkerrors.Wrap(types.ErrAssetNotFound, requestParams.MarketID) + return nil, sdkerrors.Wrap(types.ErrAssetNotFound, requestParams.MarketID) } bz, err := codec.MarshalJSONIndent(types.ModuleCdc, oracles)