Skip to content

Commit

Permalink
[vms/platformvm] Declare maxPageSize in service.go (#2881)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubabasu committed Mar 28, 2024
1 parent 42aefda commit 70cd8e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vms/platformvm/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"github.com/ava-labs/avalanchego/vms/platformvm/state"
"github.com/ava-labs/avalanchego/vms/platformvm/status"
"github.com/ava-labs/avalanchego/vms/platformvm/txs"
"github.com/ava-labs/avalanchego/vms/platformvm/txs/builder"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"

avajson "github.com/ava-labs/avalanchego/utils/json"
Expand All @@ -51,6 +50,9 @@ const (
// Max number of addresses that can be passed in as argument to GetStake
maxGetStakeAddrs = 256

// Max number of items allowed in a page
maxPageSize = 1024

// Note: Staker attributes cache should be large enough so that no evictions
// happen when the API loops through all stakers.
stakerAttributesCacheSize = 100_000
Expand Down Expand Up @@ -365,8 +367,8 @@ func (s *Service) GetUTXOs(_ *http.Request, args *api.GetUTXOsArgs, response *ap
endUTXOID ids.ID
)
limit := int(args.Limit)
if limit <= 0 || builder.MaxPageSize < limit {
limit = builder.MaxPageSize
if limit <= 0 || maxPageSize < limit {
limit = maxPageSize
}

s.vm.ctx.Lock.Lock()
Expand Down

0 comments on commit 70cd8e1

Please sign in to comment.