Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Apr 7, 2024
1 parent 28ae912 commit 8b1b3f7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions x/bank/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package keeper

import (
"context"
"slices"

"cosmossdk.io/math"
gogotypes "github.com/cosmos/gogoproto/types"
"golang.org/x/exp/slices"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

Expand Down Expand Up @@ -314,7 +314,7 @@ func (k BaseKeeper) SendEnabled(goCtx context.Context, req *types.QuerySendEnabl
req.Pagination = new(query.PageRequest)
}
if req.Pagination.Reverse {
slices.Reverse(resp.SendEnabled)
reverse(resp.SendEnabled)
}
if offset := req.Pagination.Offset; int(offset) <= len(resp.SendEnabled) {
resp.SendEnabled = resp.SendEnabled[offset:]
Expand All @@ -330,3 +330,11 @@ func (k BaseKeeper) SendEnabled(goCtx context.Context, req *types.QuerySendEnabl

return resp, nil
}

// Copied from newer version of slices package
// https://cs.opensource.google/go/x/exp/+/master:slices/slices.go;l=511
func reverse[S ~[]E, E any](s S) {
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
s[i], s[j] = s[j], s[i]
}
}

0 comments on commit 8b1b3f7

Please sign in to comment.