From 86f286ede11d0269bc4499a140224a6b933deb8b Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:25:14 +0100 Subject: [PATCH] chore: validate SyncTimeout --- config/config.go | 5 ++++- config/toml.go | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 191f84359..95e1f5d06 100644 --- a/config/config.go +++ b/config/config.go @@ -235,7 +235,6 @@ type BaseConfig struct { //nolint: maligned DeadlockDetection time.Duration `mapstructure:"deadlock-detection"` // SyncTimeout is the timeout for the initial sync process, before switching to consensus. - // If zero or empty, the default value is used. // // Default: 60s SyncTimeout time.Duration `mapstructure:"sync-timeout"` @@ -361,6 +360,10 @@ func (cfg BaseConfig) ValidateBasic() error { return fmt.Errorf("unsupported db backend: %s, only goleveldb is supported", cfg.DBBackend) } + if cfg.SyncTimeout < 0 { + return errors.New("sync-timeout can't be negative, got: " + cfg.SyncTimeout.String()) + } + return nil } diff --git a/config/toml.go b/config/toml.go index a7183369c..8ec31e01a 100644 --- a/config/toml.go +++ b/config/toml.go @@ -138,7 +138,6 @@ filter-peers = {{ .BaseConfig.FilterPeers }} deadlock-detection = "{{ .BaseConfig.DeadlockDetection }}" # Timeout for the initial sync process, before switching to consensus. -# If zero or empty, the default value is used. # # Default: 60s sync-timeout = "{{ .BaseConfig.SyncTimeout }}"