Skip to content

Commit 2f1c922

Browse files
committed
chore: remove server side changes
1 parent 94915eb commit 2f1c922

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

x/market/keeper/grpc_query.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,13 @@ func (k Querier) Orders(c context.Context, req *types.QueryOrdersRequest) (*type
125125
return nil, status.Error(codes.Internal, err.Error())
126126
}
127127

128-
// Keep raw SDK NextKey to prevent corruption across page boundaries
129-
// Do not prepend searchPrefix as it corrupts the key for subsequent requests
128+
if len(pageRes.NextKey) > 0 {
129+
nextKey := make([]byte, len(searchPrefix)+len(pageRes.NextKey))
130+
copy(nextKey, searchPrefix)
131+
copy(nextKey[len(searchPrefix):], pageRes.NextKey)
132+
133+
pageRes.NextKey = nextKey
134+
}
130135

131136
req.Pagination.Limit -= count
132137
total += count
@@ -191,7 +196,7 @@ func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.Qu
191196
}
192197
req.Pagination.Key = key
193198

194-
if unsolicited[0] == 1 {
199+
if unsolicited[1] == 1 {
195200
reverseSearch = true
196201
}
197202
} else if req.Filters.State != "" {
@@ -273,8 +278,13 @@ func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.Qu
273278
return nil, status.Error(codes.Internal, err.Error())
274279
}
275280

276-
// Keep raw SDK NextKey to prevent corruption across page boundaries
277-
// Do not prepend searchPrefix as it corrupts the key for subsequent requests
281+
if len(pageRes.NextKey) > 0 {
282+
nextKey := make([]byte, len(searchPrefix)+len(pageRes.NextKey))
283+
copy(nextKey, searchPrefix)
284+
copy(nextKey[len(searchPrefix):], pageRes.NextKey)
285+
286+
pageRes.NextKey = nextKey
287+
}
278288

279289
req.Pagination.Limit -= count
280290
total += count
@@ -548,4 +558,4 @@ func (k Querier) Lease(c context.Context, req *types.QueryLeaseRequest) (*types.
548558
Lease: lease,
549559
EscrowPayment: payment,
550560
}, nil
551-
}
561+
}

0 commit comments

Comments
 (0)