Skip to content

Commit

Permalink
chore: validate SyncTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Dec 19, 2024
1 parent 6118718 commit 86f286e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down

0 comments on commit 86f286e

Please sign in to comment.