From 8f94fc26e3a9de7a756df455f12f6a8fe2a6ed09 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Mon, 3 May 2021 14:29:05 +0200 Subject: [PATCH] cmd/utils: don't crash on nonexistent datadir (#22738) --- cmd/utils/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 59cf32c98..a50fdd968 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1662,7 +1662,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 }