config: fix duration parameter types

These parameters denote seconds and are thus unitless integers, not
durations.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-09-25 13:09:37 +03:00
parent 63c939b9fa
commit 7fa6c8dcf6
2 changed files with 8 additions and 10 deletions

View file

@ -1,8 +1,6 @@
package config
import (
"time"
"github.com/nspcc-dev/neo-go/pkg/core/storage"
"github.com/nspcc-dev/neo-go/pkg/network/metrics"
"github.com/nspcc-dev/neo-go/pkg/rpc"
@ -14,16 +12,16 @@ type ApplicationConfiguration struct {
AnnouncedNodePort uint16 `yaml:"AnnouncedPort"`
AttemptConnPeers int `yaml:"AttemptConnPeers"`
DBConfiguration storage.DBConfiguration `yaml:"DBConfiguration"`
DialTimeout time.Duration `yaml:"DialTimeout"`
DialTimeout int64 `yaml:"DialTimeout"`
LogPath string `yaml:"LogPath"`
MaxPeers int `yaml:"MaxPeers"`
MinPeers int `yaml:"MinPeers"`
NodePort uint16 `yaml:"NodePort"`
PingInterval time.Duration `yaml:"PingInterval"`
PingTimeout time.Duration `yaml:"PingTimeout"`
PingInterval int64 `yaml:"PingInterval"`
PingTimeout int64 `yaml:"PingTimeout"`
Pprof metrics.Config `yaml:"Pprof"`
Prometheus metrics.Config `yaml:"Prometheus"`
ProtoTickInterval time.Duration `yaml:"ProtoTickInterval"`
ProtoTickInterval int64 `yaml:"ProtoTickInterval"`
Relay bool `yaml:"Relay"`
RPC rpc.Config `yaml:"RPC"`
UnlockWallet Wallet `yaml:"UnlockWallet"`

View file

@ -103,10 +103,10 @@ func NewServerConfig(cfg config.Config) ServerConfig {
Net: protoConfig.Magic,
Relay: appConfig.Relay,
Seeds: protoConfig.SeedList,
DialTimeout: appConfig.DialTimeout * time.Second,
ProtoTickInterval: appConfig.ProtoTickInterval * time.Second,
PingInterval: appConfig.PingInterval * time.Second,
PingTimeout: appConfig.PingTimeout * time.Second,
DialTimeout: time.Duration(appConfig.DialTimeout) * time.Second,
ProtoTickInterval: time.Duration(appConfig.ProtoTickInterval) * time.Second,
PingInterval: time.Duration(appConfig.PingInterval) * time.Second,
PingTimeout: time.Duration(appConfig.PingTimeout) * time.Second,
MaxPeers: appConfig.MaxPeers,
AttemptConnPeers: appConfig.AttemptConnPeers,
MinPeers: appConfig.MinPeers,