diff --git a/pkg/config/config.go b/pkg/config/config.go index 0accd2710..086f23704 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -26,6 +26,9 @@ const ( // DefaultMaxFindStorageResultItems is the default maximum number of resulting // contract storage items that can be retrieved by `findstorge` JSON-RPC handler. DefaultMaxFindStorageResultItems = 50 + // DefaultMaxNEP11Tokens is the default maximum number of resulting NEP11 tokens + // that can be traversed by `getnep11balances` JSON-RPC handler. + DefaultMaxNEP11Tokens = 100 ) // Version is the version of the node, set at the build time. @@ -77,9 +80,6 @@ func LoadFile(configPath string) (Config, error) { PingInterval: 30 * time.Second, PingTimeout: 90 * time.Second, }, - RPC: RPC{ - MaxNEP11Tokens: 100, - }, }, } diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index fa6a4af11..4e843bc25 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -307,6 +307,10 @@ func New(chain Ledger, conf config.RPC, coreServer *network.Server, conf.MaxFindStorageResultItems = config.DefaultMaxFindStorageResultItems log.Info("MaxFindStorageResultItems is not set or wrong, setting default value", zap.Int("MaxFindStorageResultItems", config.DefaultMaxFindStorageResultItems)) } + if conf.MaxNEP11Tokens <= 0 { + conf.MaxNEP11Tokens = config.DefaultMaxNEP11Tokens + log.Info("MaxNEP11Tokens is not set or wrong, setting default value", zap.Int("MaxNEP11Tokens", config.DefaultMaxNEP11Tokens)) + } if conf.MaxWebSocketClients == 0 { conf.MaxWebSocketClients = defaultMaxWebSocketClients log.Info("MaxWebSocketClients is not set or wrong, setting default value", zap.Int("MaxWebSocketClients", defaultMaxWebSocketClients))