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:
Lorenz Herzberger 2024-06-03 09:31:25 +02:00
parent 3a2e5f423f
commit f299b6c3e4
No known key found for this signature in database
GPG Key ID: FA5EE906EB55316A
2 changed files with 2 additions and 2 deletions

View File

@ -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")
} }

View File

@ -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