@ -76,7 +76,7 @@ type Config struct {
P2P * P2PConfig ` mapstructure:"p2p" `
P2P * P2PConfig ` mapstructure:"p2p" `
Mempool * MempoolConfig ` mapstructure:"mempool" `
Mempool * MempoolConfig ` mapstructure:"mempool" `
StateSync * StateSyncConfig ` mapstructure:"statesync" `
StateSync * StateSyncConfig ` mapstructure:"statesync" `
BlockSync * BlockSyncConfig ` mapstructure:"fast sync" `
BlockSync * BlockSyncConfig ` mapstructure:"block sync" `
Consensus * ConsensusConfig ` mapstructure:"consensus" `
Consensus * ConsensusConfig ` mapstructure:"consensus" `
TxIndex * TxIndexConfig ` mapstructure:"tx-index" `
TxIndex * TxIndexConfig ` mapstructure:"tx-index" `
Instrumentation * InstrumentationConfig ` mapstructure:"instrumentation" `
Instrumentation * InstrumentationConfig ` mapstructure:"instrumentation" `
@ -152,7 +152,7 @@ func (cfg *Config) ValidateBasic() error {
return fmt . Errorf ( "error in [statesync] section: %w" , err )
return fmt . Errorf ( "error in [statesync] section: %w" , err )
}
}
if err := cfg . BlockSync . ValidateBasic ( ) ; err != nil {
if err := cfg . BlockSync . ValidateBasic ( ) ; err != nil {
return fmt . Errorf ( "error in [fast sync] section: %w" , err )
return fmt . Errorf ( "error in [block sync] section: %w" , err )
}
}
if err := cfg . Consensus . ValidateBasic ( ) ; err != nil {
if err := cfg . Consensus . ValidateBasic ( ) ; err != nil {
return fmt . Errorf ( "error in [consensus] section: %w" , err )
return fmt . Errorf ( "error in [consensus] section: %w" , err )
@ -194,12 +194,6 @@ type BaseConfig struct { //nolint: maligned
// - No priv_validator_key.json, priv_validator_state.json
// - No priv_validator_key.json, priv_validator_state.json
Mode string ` mapstructure:"mode" `
Mode string ` mapstructure:"mode" `
// If this node is many blocks behind the tip of the chain, FastSync
// allows them to catchup quickly by downloading blocks in parallel
// and verifying their commits
// TODO: This should be moved to the blocksync config
FastSyncMode bool ` mapstructure:"fast-sync" `
// Database backend: goleveldb | cleveldb | boltdb | rocksdb
// Database backend: goleveldb | cleveldb | boltdb | rocksdb
// * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
// * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
// - pure go
// - pure go
@ -242,23 +236,24 @@ type BaseConfig struct { //nolint: maligned
// If true, query the ABCI app on connecting to a new peer
// If true, query the ABCI app on connecting to a new peer
// so the app can decide if we should keep the connection or not
// so the app can decide if we should keep the connection or not
FilterPeers bool ` mapstructure:"filter-peers" ` // false
FilterPeers bool ` mapstructure:"filter-peers" ` // false
Other map [ string ] interface { } ` mapstructure:",remain" `
}
}
// DefaultBaseConfig returns a default base configuration for a Tendermint node
// DefaultBaseConfig returns a default base configuration for a Tendermint node
func DefaultBaseConfig ( ) BaseConfig {
func DefaultBaseConfig ( ) BaseConfig {
return BaseConfig {
return BaseConfig {
Genesis : defaultGenesisJSONPath ,
NodeKey : defaultNodeKeyPath ,
Mode : defaultMode ,
Moniker : defaultMoniker ,
ProxyApp : "tcp://127.0.0.1:26658" ,
ABCI : "socket" ,
LogLevel : DefaultLogLevel ,
LogFormat : log . LogFormatPlain ,
FastSyncMode : true ,
FilterPeers : false ,
DBBackend : "goleveldb" ,
DBPath : "data" ,
Genesis : defaultGenesisJSONPath ,
NodeKey : defaultNodeKeyPath ,
Mode : defaultMode ,
Moniker : defaultMoniker ,
ProxyApp : "tcp://127.0.0.1:26658" ,
ABCI : "socket" ,
LogLevel : DefaultLogLevel ,
LogFormat : log . LogFormatPlain ,
FilterPeers : false ,
DBBackend : "goleveldb" ,
DBPath : "data" ,
}
}
}
}
@ -268,7 +263,6 @@ func TestBaseConfig() BaseConfig {
cfg . chainID = "tendermint_test"
cfg . chainID = "tendermint_test"
cfg . Mode = ModeValidator
cfg . Mode = ModeValidator
cfg . ProxyApp = "kvstore"
cfg . ProxyApp = "kvstore"
cfg . FastSyncMode = false
cfg . DBBackend = "memdb"
cfg . DBBackend = "memdb"
return cfg
return cfg
}
}
@ -345,6 +339,28 @@ func (cfg BaseConfig) ValidateBasic() error {
return fmt . Errorf ( "unknown mode: %v" , cfg . Mode )
return fmt . Errorf ( "unknown mode: %v" , cfg . Mode )
}
}
// TODO (https://github.com/tendermint/tendermint/issues/6908) remove this check after the v0.35 release cycle.
// This check was added to give users an upgrade prompt to use the new
// configuration option in v0.35. In future release cycles they should no longer
// be using this configuration parameter so the check can be removed.
// The cfg.Other field can likely be removed at the same time if it is not referenced
// elsewhere as it was added to service this check.
if fs , ok := cfg . Other [ "fastsync" ] ; ok {
if _ , ok := fs . ( map [ string ] interface { } ) ; ok {
return fmt . Errorf ( "a configuration section named 'fastsync' was found in the " +
"configuration file. The 'fastsync' section has been renamed to " +
"'blocksync', please update the 'fastsync' field in your configuration file to 'blocksync'" )
}
}
if fs , ok := cfg . Other [ "fast-sync" ] ; ok {
if fs != "" {
return fmt . Errorf ( "a parameter named 'fast-sync' was found in the " +
"configuration file. The parameter to enable or disable quickly syncing with a blockchain" +
"has moved to the [blocksync] section of the configuration file as blocksync.enable. " +
"Please move the 'fast-sync' field in your configuration file to 'blocksync.enable'" )
}
}
return nil
return nil
}
}
@ -1005,13 +1021,18 @@ func (cfg *StateSyncConfig) ValidateBasic() error {
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// BlockSyncConfig (formerly known as FastSync) defines the configuration for the Tendermint block sync service
// BlockSyncConfig (formerly known as FastSync) defines the configuration for the Tendermint block sync service
// If this node is many blocks behind the tip of the chain, BlockSync
// allows them to catchup quickly by downloading blocks in parallel
// and verifying their commits.
type BlockSyncConfig struct {
type BlockSyncConfig struct {
Enable bool ` mapstructure:"enable" `
Version string ` mapstructure:"version" `
Version string ` mapstructure:"version" `
}
}
// DefaultBlockSyncConfig returns a default configuration for the block sync service
// DefaultBlockSyncConfig returns a default configuration for the block sync service
func DefaultBlockSyncConfig ( ) * BlockSyncConfig {
func DefaultBlockSyncConfig ( ) * BlockSyncConfig {
return & BlockSyncConfig {
return & BlockSyncConfig {
Enable : true ,
Version : BlockSyncV0 ,
Version : BlockSyncV0 ,
}
}
}
}