diff options
author | gary rong <garyrong0905@gmail.com> | 2019-07-11 19:37:08 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-07-11 19:37:08 +0800 |
commit | 252150918c50a1428eb4ceec714f5de40247d8ce (patch) | |
tree | 24d3d68f7b1e11a18620d1a31d96c4ae06d3d6dc | |
parent | 72029f0f88f6263c74efc03eed7f09dd2c249d6a (diff) | |
download | go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.tar go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.tar.gz go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.tar.bz2 go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.tar.lz go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.tar.xz go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.tar.zst go-tangerine-252150918c50a1428eb4ceec714f5de40247d8ce.zip |
cmd, eth: fix dump config issue (#19825)
* eth: fix error when dump config with nil checkpoint
* cmd/utils: ignore default datadir if it's already set.
-rw-r--r-- | cmd/utils/flags.go | 6 | ||||
-rw-r--r-- | eth/config.go | 4 | ||||
-rw-r--r-- | eth/gen_config.go | 12 |
3 files changed, 11 insertions, 11 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 27dbb7313..7e28dff79 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1202,11 +1202,11 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { cfg.DataDir = ctx.GlobalString(DataDirFlag.Name) case ctx.GlobalBool(DeveloperFlag.Name): cfg.DataDir = "" // unless explicitly requested, use memory databases - case ctx.GlobalBool(TestnetFlag.Name): + case ctx.GlobalBool(TestnetFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet") - case ctx.GlobalBool(RinkebyFlag.Name): + case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby") - case ctx.GlobalBool(GoerliFlag.Name): + case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli") } } diff --git a/eth/config.go b/eth/config.go index c29655375..688787227 100644 --- a/eth/config.go +++ b/eth/config.go @@ -150,8 +150,8 @@ type Config struct { RPCGasCap *big.Int `toml:",omitempty"` // Checkpoint is a hardcoded checkpoint which can be nil. - Checkpoint *params.TrustedCheckpoint + Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` // CheckpointOracle is the configuration for checkpoint oracle. - CheckpointOracle *params.CheckpointOracleConfig + CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` } diff --git a/eth/gen_config.go b/eth/gen_config.go index a7794ffab..bc4b55b12 100644 --- a/eth/gen_config.go +++ b/eth/gen_config.go @@ -46,9 +46,9 @@ func (c Config) MarshalTOML() (interface{}, error) { DocRoot string `toml:"-"` EWASMInterpreter string EVMInterpreter string - RPCGasCap *big.Int `toml:",omitempty"` - Checkpoint *params.TrustedCheckpoint - CheckpointOracle *params.CheckpointOracleConfig + RPCGasCap *big.Int `toml:",omitempty"` + Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` + CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` } var enc Config enc.Genesis = c.Genesis @@ -116,9 +116,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { DocRoot *string `toml:"-"` EWASMInterpreter *string EVMInterpreter *string - RPCGasCap *big.Int `toml:",omitempty"` - Checkpoint *params.TrustedCheckpoint - CheckpointOracle *params.CheckpointOracleConfig + RPCGasCap *big.Int `toml:",omitempty"` + Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` + CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` } var dec Config if err := unmarshal(&dec); err != nil { |