Skip to content

Commit 2521509

Browse files
rjl493456442karalabe
authored andcommitted
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.
1 parent 72029f0 commit 2521509

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎cmd/utils/flags.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,11 +1202,11 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
12021202
cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
12031203
case ctx.GlobalBool(DeveloperFlag.Name):
12041204
cfg.DataDir = "" // unless explicitly requested, use memory databases
1205-
case ctx.GlobalBool(TestnetFlag.Name):
1205+
case ctx.GlobalBool(TestnetFlag.Name) && cfg.DataDir == node.DefaultDataDir():
12061206
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
1207-
case ctx.GlobalBool(RinkebyFlag.Name):
1207+
case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir():
12081208
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
1209-
case ctx.GlobalBool(GoerliFlag.Name):
1209+
case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir():
12101210
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli")
12111211
}
12121212
}

‎eth/config.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ type Config struct {
150150
RPCGasCap *big.Int `toml:",omitempty"`
151151

152152
// Checkpoint is a hardcoded checkpoint which can be nil.
153-
Checkpoint *params.TrustedCheckpoint
153+
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
154154

155155
// CheckpointOracle is the configuration for checkpoint oracle.
156-
CheckpointOracle *params.CheckpointOracleConfig
156+
CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"`
157157
}

‎eth/gen_config.go‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)