diff --git a/pkg/config/config.go b/pkg/config/config.go index ed701d8ac..47318828c 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -20,6 +20,9 @@ const ( // iterator items per JSON-RPC response. It covers both session-based and // naive iterators. DefaultMaxIteratorResultItems = 100 + // DefaultMaxFindResultItems is the default maximum number of resulting + // contract states items that can be retrieved by `findstates` JSON-RPC handler. + DefaultMaxFindResultItems = 100 // DefaultMaxFindStorageResultItems is the default maximum number of resulting // contract storage items that can be retrieved by `findstorge` JSON-RPC handler. DefaultMaxFindStorageResultItems = 50 @@ -75,7 +78,6 @@ func LoadFile(configPath string) (Config, error) { PingTimeout: 90 * time.Second, }, RPC: RPC{ - MaxFindResultItems: 100, MaxFindStorageResultItems: DefaultMaxFindStorageResultItems, MaxNEP11Tokens: 100, }, diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index 153458cc7..d1f1a00c5 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -299,6 +299,10 @@ func New(chain Ledger, conf config.RPC, coreServer *network.Server, conf.MaxIteratorResultItems = config.DefaultMaxIteratorResultItems log.Info("MaxIteratorResultItems is not set or wrong, setting default value", zap.Int("MaxIteratorResultItems", config.DefaultMaxIteratorResultItems)) } + if conf.MaxFindResultItems <= 0 { + conf.MaxFindResultItems = config.DefaultMaxFindResultItems + log.Info("MaxFindResultItems is not set or wrong, setting default value", zap.Int("MaxFindResultItems", config.DefaultMaxFindResultItems)) + } if conf.MaxWebSocketClients == 0 { conf.MaxWebSocketClients = defaultMaxWebSocketClients log.Info("MaxWebSocketClients is not set or wrong, setting default value", zap.Int("MaxWebSocketClients", defaultMaxWebSocketClients))