Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vms/platformvm] Declare maxPageSize in service.go #2881

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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