mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 14:35:47 +00:00
fix: adjust call to GetAssetsByAddress with numElements + 1 because store.ReverseIterator is exclusive
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
3a2e5f423f
commit
f299b6c3e4
@ -18,7 +18,7 @@ func (k Keeper) GetCIDsByAddress(goCtx context.Context, req *types.QueryGetCIDsB
|
|||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
cids, found := k.GetAssetsByAddress(ctx, req.GetAddress(), nil, util.SerializeUint64(req.GetNumElements()))
|
cids, found := k.GetAssetsByAddress(ctx, req.GetAddress(), nil, util.SerializeUint64(req.GetNumElements()+1))
|
||||||
if !found {
|
if !found {
|
||||||
return nil, status.Error(codes.NotFound, "no CIDs found")
|
return nil, status.Error(codes.NotFound, "no CIDs found")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ func TestGetNotarizedAssetByAddress(t *testing.T) {
|
|||||||
keeper, ctx := keepertest.AssetKeeper(t)
|
keeper, ctx := keepertest.AssetKeeper(t)
|
||||||
wctx := sdk.WrapSDKContext(ctx)
|
wctx := sdk.WrapSDKContext(ctx)
|
||||||
_ = createNAsset(keeper, ctx, 10)
|
_ = createNAsset(keeper, ctx, 10)
|
||||||
assets, _ := keeper.GetAssetsByAddress(ctx, "plmnt_address", nil, util.SerializeUint64(3))
|
assets, _ := keeper.GetAssetsByAddress(ctx, "plmnt_address", nil, util.SerializeUint64(3+1))
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
desc string
|
desc string
|
||||||
request *types.QueryGetCIDsByAddressRequest
|
request *types.QueryGetCIDsByAddressRequest
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user