ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.
()
| 327 | // ValidateBasic performs basic validation (checking param bounds, etc.) and |
| 328 | // returns an error if any check fails. |
| 329 | func (cfg BaseConfig) ValidateBasic() error { |
| 330 | switch cfg.LogFormat { |
| 331 | case log.LogFormatJSON, log.LogFormatText, log.LogFormatPlain: |
| 332 | default: |
| 333 | return errors.New("unknown log format (must be 'plain', 'text' or 'json')") |
| 334 | } |
| 335 | |
| 336 | switch cfg.Mode { |
| 337 | case ModeFull, ModeValidator, ModeSeed: |
| 338 | case "": |
| 339 | return errors.New("no mode has been set") |
| 340 | |
| 341 | default: |
| 342 | return fmt.Errorf("unknown mode: %v", cfg.Mode) |
| 343 | } |
| 344 | |
| 345 | // TODO (https://github.com/tendermint/tendermint/issues/6908) remove this check after the v0.35 release cycle. |
| 346 | // This check was added to give users an upgrade prompt to use the new |
| 347 | // configuration option in v0.35. In future release cycles they should no longer |
| 348 | // be using this configuration parameter so the check can be removed. |
| 349 | // The cfg.Other field can likely be removed at the same time if it is not referenced |
| 350 | // elsewhere as it was added to service this check. |
| 351 | if fs, ok := cfg.Other["fastsync"]; ok { |
| 352 | if _, ok := fs.(map[string]interface{}); ok { |
| 353 | return fmt.Errorf("a configuration section named 'fastsync' was found in the " + |
| 354 | "configuration file. The 'fastsync' section has been renamed to " + |
| 355 | "'blocksync', please update the 'fastsync' field in your configuration file to 'blocksync'") |
| 356 | } |
| 357 | } |
| 358 | if fs, ok := cfg.Other["fast-sync"]; ok { |
| 359 | if fs != "" { |
| 360 | return fmt.Errorf("a parameter named 'fast-sync' was found in the " + |
| 361 | "configuration file. The parameter to enable or disable quickly syncing with a blockchain" + |
| 362 | "has moved to the [blocksync] section of the configuration file as blocksync.enable. " + |
| 363 | "Please move the 'fast-sync' field in your configuration file to 'blocksync.enable'") |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | return nil |
| 368 | } |
| 369 | |
| 370 | //----------------------------------------------------------------------------- |
| 371 | // PrivValidatorConfig |
nothing calls this directly
no outgoing calls
no test coverage detected