mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55:18 +00:00
fix: return nil instead of empty byte slice (#878)
This commit is contained in:
parent
12f5a67d6d
commit
2611d48b77
@ -41,7 +41,7 @@ func queryPrice(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) (res []by
|
|||||||
}
|
}
|
||||||
_, found := keeper.GetMarket(ctx, requestParams.MarketID)
|
_, found := keeper.GetMarket(ctx, requestParams.MarketID)
|
||||||
if !found {
|
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)
|
currentPrice, sdkErr := keeper.GetCurrentPrice(ctx, requestParams.MarketID)
|
||||||
if sdkErr != nil {
|
if sdkErr != nil {
|
||||||
@ -72,7 +72,7 @@ func queryRawPrices(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) (res
|
|||||||
}
|
}
|
||||||
_, found := keeper.GetMarket(ctx, requestParams.MarketID)
|
_, found := keeper.GetMarket(ctx, requestParams.MarketID)
|
||||||
if !found {
|
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)
|
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)
|
oracles, err := keeper.GetOracles(ctx, requestParams.MarketID)
|
||||||
if err != nil {
|
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)
|
bz, err := codec.MarshalJSONIndent(types.ModuleCdc, oracles)
|
||||||
|
Loading…
Reference in New Issue
Block a user