func DefaultPackageLogLevels() string {
	return fmt.Sprintf("consensus:info,main:info,state:info,*:%s", DefaultLogLevel())
}
DefaultPackageLogLevels returns a default log level setting so all packages
log at "error", while the `state` and `main` packages log at "info"
package config
import (
	"fmt"
	tmConfig "github.com/tendermint/tendermint/config"
	"os"
	"path/filepath"
	"time"
)
const (
	LogFormatPlain = "plain"
	LogFormatJSON = "json"
	DefaultConfigDir = "config"
	DefaultDataDir   = "data"
	defaultConfigFileName  = "config.toml"
	defaultGenesisJSONName = "genesis.json"
	defaultPrivValName      = "priv_validator.json"
	defaultPrivValStateName = "priv_validator_state.json"
	defaultNodeKeyName      = "node_key.json"
)
var (
	defaultConfigFilePath   = filepath.Join(DefaultConfigDir, defaultConfigFileName)
	defaultGenesisJSONPath  = filepath.Join(DefaultConfigDir, defaultGenesisJSONName)
	defaultPrivValKeyPath   = filepath.Join(DefaultConfigDir, defaultPrivValName)
	defaultPrivValStatePath = filepath.Join(DefaultConfigDir, defaultPrivValStateName)
	defaultNodeKeyPath      = filepath.Join(DefaultConfigDir, defaultNodeKeyName)
)
func DefaultConfig() *Config {
	cfg := defaultConfig()
	cfg.P2P.Seeds = "25104d4b173d1047e9d1a70cdefde9e30707beb1@84.201.143.192:26656," +
		"1e1c6149451d2a7c1072523e49cab658080d9bd2@minter-nodes-1.mainnet.btcsecure.io:26656," +
		"c578fba1bdb5265be75dd412f8cf1bbeb7399620@seed.minter.stakeholder.space:26656," +
		"bab220855eb9625ea547f1ef1d11692c60a7a406@138.201.28.219:26656"
	cfg.TxIndex = &tmConfig.TxIndexConfig{
		Indexer: "kv",
	}
	cfg.DBPath = "tmdata"
	cfg.Mempool.CacheSize = 100000
	cfg.Mempool.Recheck = false
	cfg.Mempool.Size = 10000
	cfg.Consensus.WalPath = "tmdata/cs.wal/wal"
	cfg.Consensus.TimeoutPropose = 2 * time.Second                
	cfg.Consensus.TimeoutProposeDelta = 500 * time.Millisecond    
	cfg.Consensus.TimeoutPrevote = 1 * time.Second                
	cfg.Consensus.TimeoutPrevoteDelta = 500 * time.Millisecond    
	cfg.Consensus.TimeoutPrecommit = 1 * time.Second              
	cfg.Consensus.TimeoutPrecommitDelta = 500 * time.Millisecond  
	cfg.Consensus.TimeoutCommit = 4200 * time.Millisecond         
	cfg.P2P.RecvRate = 15360000  
	cfg.P2P.SendRate = 15360000  
	cfg.P2P.FlushThrottleTimeout = 10 * time.Millisecond
	cfg.PrivValidatorKey = "config/priv_validator.json"
	cfg.PrivValidatorState = "config/priv_validator_state.json"
	cfg.NodeKey = "config/node_key.json"
	return cfg
}
func GetConfig(home string) *Config {
	cfg := DefaultConfig()
	if cfg.ValidatorMode {
		cfg.RPC.ListenAddress = ""
		cfg.RPC.GRPCListenAddress = ""
	}
	cfg.Mempool.Recheck = false
	cfg.P2P.AddrBook = "config/addrbook.json"
	cfg.SetRoot(home)
	EnsureRoot(home)
	return cfg
}
type Config struct {
	BaseConfig `mapstructure:",squash"`
	RPC             *tmConfig.RPCConfig             `mapstructure:"rpc"`
	P2P             *tmConfig.P2PConfig             `mapstructure:"p2p"`
	Mempool         *tmConfig.MempoolConfig         `mapstructure:"mempool"`
	Consensus       *tmConfig.ConsensusConfig       `mapstructure:"consensus"`
	TxIndex         *tmConfig.TxIndexConfig         `mapstructure:"tx_index"`
	Instrumentation *tmConfig.InstrumentationConfig `mapstructure:"instrumentation"`
}
func defaultConfig() *Config {
	return &Config{
		BaseConfig:      DefaultBaseConfig(),
		RPC:             tmConfig.DefaultRPCConfig(),
		P2P:             tmConfig.DefaultP2PConfig(),
		Mempool:         tmConfig.DefaultMempoolConfig(),
		Consensus:       tmConfig.DefaultConsensusConfig(),
		TxIndex:         tmConfig.DefaultTxIndexConfig(),
		Instrumentation: tmConfig.DefaultInstrumentationConfig(),
	}
}
func (cfg *Config) SetRoot(root string) *Config {
	cfg.BaseConfig.RootDir = root
	cfg.RPC.RootDir = root
	cfg.P2P.RootDir = root
	cfg.Mempool.RootDir = root
	cfg.Consensus.RootDir = root
	return cfg
}
func GetTmConfig(cfg *Config) *tmConfig.Config {
	return &tmConfig.Config{
		BaseConfig: tmConfig.BaseConfig{
			RootDir:                 cfg.RootDir,
			ProxyApp:                cfg.ProxyApp,
			Moniker:                 cfg.Moniker,
			FastSyncMode:            cfg.FastSync,
			DBBackend:               cfg.DBBackend,
			DBPath:                  cfg.DBPath,
			LogLevel:                cfg.LogLevel,
			LogFormat:               cfg.LogFormat,
			Genesis:                 cfg.Genesis,
			PrivValidatorKey:        cfg.PrivValidatorKey,
			PrivValidatorState:      cfg.PrivValidatorState,
			PrivValidatorListenAddr: cfg.PrivValidatorListenAddr,
			NodeKey:                 cfg.NodeKey,
			ABCI:                    cfg.ABCI,
			FilterPeers:             cfg.FilterPeers,
		},
		RPC:     cfg.RPC,
		P2P:     cfg.P2P,
		Mempool: cfg.Mempool,
		StateSync:       tmConfig.DefaultStateSyncConfig(),
		FastSync:        tmConfig.DefaultFastSyncConfig(),
		Consensus:       cfg.Consensus,
		TxIndex:         cfg.TxIndex,
		Instrumentation: cfg.Instrumentation,
	}
}
type BaseConfig struct {
	chainID string
	RootDir string `mapstructure:"home"`
	Genesis string `mapstructure:"genesis_file"`
	PrivValidatorKey string `mapstructure:"priv_validator_key_file"`
	PrivValidatorState string `mapstructure:"priv_validator_state_file"`
	PrivValidatorListenAddr string `mapstructure:"priv_validator_laddr"`
	NodeKey string `mapstructure:"node_key_file"`
	Moniker string `mapstructure:"moniker"`
	ProxyApp string `mapstructure:"proxy_app"`
	ABCI string `mapstructure:"abci"`
	LogLevel string `mapstructure:"log_level"`
	LogFormat string `mapstructure:"log_format"`
	ProfListenAddress string `mapstructure:"prof_laddr"`
	FastSync bool `mapstructure:"fast_sync"`
	FilterPeers bool `mapstructure:"filter_peers"`  
	DBBackend string `mapstructure:"db_backend"`
	DBPath string `mapstructure:"db_dir"`
	GRPCListenAddress string `mapstructure:"grpc_listen_addr"`
	APIv2ListenAddress string `mapstructure:"api_v2_listen_addr"`
	APIv2TimeoutDuration time.Duration `mapstructure:"api_v2_timeout_duration"`
	WSConnectionDuration time.Duration `mapstructure:"ws_connection_duration"`
	ValidatorMode bool `mapstructure:"validator_mode"`
	KeepLastStates int64 `mapstructure:"keep_last_states"`
	APISimultaneousRequests int `mapstructure:"api_simultaneous_requests"`
	LogPath string `mapstructure:"log_path"`
	StateCacheSize int `mapstructure:"state_cache_size"`
	StateMemAvailable int `mapstructure:"state_mem_available"`
	HaltHeight int `mapstructure:"halt_height"`
}
func DefaultBaseConfig() BaseConfig {
	return BaseConfig{
		Genesis:                 defaultGenesisJSONPath,
		PrivValidatorKey:        defaultPrivValKeyPath,
		PrivValidatorState:      defaultPrivValStatePath,
		NodeKey:                 defaultNodeKeyPath,
		Moniker:                 defaultMoniker,
		LogLevel:                DefaultPackageLogLevels(),
		ProfListenAddress:       "",
		FastSync:                true,
		FilterPeers:             false,
		DBBackend:               "goleveldb",
		DBPath:                  "data",
		GRPCListenAddress:       "tcp://0.0.0.0:8842",
		APIv2ListenAddress:      "tcp://0.0.0.0:8843",
		APIv2TimeoutDuration:    10 * time.Second,
		WSConnectionDuration:    time.Minute,
		ValidatorMode:           false,
		KeepLastStates:          120,
		StateCacheSize:          1000000,
		StateMemAvailable:       1024,
		APISimultaneousRequests: 100,
		LogPath:                 "stdout",
		LogFormat:               LogFormatPlain,
	}
}
func (cfg BaseConfig) ChainID() string {
	return cfg.chainID
}
func (cfg BaseConfig) GenesisFile() string {
	return rootify(cfg.Genesis, cfg.RootDir)
}
func (cfg BaseConfig) PrivValidatorStateFile() string {
	return rootify(cfg.PrivValidatorState, cfg.RootDir)
}
func (cfg BaseConfig) NodeKeyFile() string {
	return rootify(cfg.NodeKey, cfg.RootDir)
}
func (cfg BaseConfig) PrivValidatorKeyFile() string {
	return rootify(cfg.PrivValidatorKey, cfg.RootDir)
}
func (cfg BaseConfig) DBDir() string {
	return rootify(cfg.DBPath, cfg.RootDir)
}
func DefaultLogLevel() string {
	return "error"
}