Skip to content

Commit

Permalink
cmd/utils: don't crash on nonexistent datadir (ethereum#22738)
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden authored and atif-konasl committed Oct 15, 2021
1 parent 759cbc6 commit 03a80e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.GlobalIsSet(DataDirFlag.Name) {
// Check if we have an already initialized chain and fall back to
// that if so. Otherwise we need to generate a new genesis spec.
chaindb := MakeChainDatabase(ctx, stack, true)
chaindb := MakeChainDatabase(ctx, stack, false) // TODO (MariusVanDerWijden) make this read only
if rawdb.ReadCanonicalHash(chaindb, 0) != (common.Hash{}) {
cfg.Genesis = nil // fallback to db content
}
Expand Down

0 comments on commit 03a80e9

Please sign in to comment.