diff --git a/docs/node-configuration.md b/docs/node-configuration.md index 2e635ecef..b3a87ad08 100644 --- a/docs/node-configuration.md +++ b/docs/node-configuration.md @@ -250,8 +250,8 @@ where: enable `SessionBackedByMPT`, see `SessionBackedByMPT` documentation for more details. - `SessionExpirationTime` is a lifetime of iterator session in seconds. It is set - to `TimePerBlock` seconds by default and is relevant only if `SessionEnabled` - is set to `true`. + to `TimePerBlock` seconds (but not less than 5s) by default and is relevant + only if `SessionEnabled` is set to `true`. - `SessionBackedByMPT` is a flag forcing JSON-RPC server into using MPT-backed storage for delayed iterator traversal. If `true`, then iterator resources got after `invoke*` calls will be released immediately. Further iterator traversing diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index 755140a36..7269fe219 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -274,6 +274,9 @@ func New(chain Ledger, conf config.RPC, coreServer *network.Server, if conf.SessionEnabled { if conf.SessionExpirationTime <= 0 { conf.SessionExpirationTime = int(protoCfg.TimePerBlock / time.Second) + if conf.SessionExpirationTime < 5 { + conf.SessionExpirationTime = 5 + } log.Info("SessionExpirationTime is not set or wrong, setting default value", zap.Int("SessionExpirationTime", conf.SessionExpirationTime)) } if conf.SessionPoolSize <= 0 {