fix(cmd): check pruneancient when creating db (#1986)

This commit is contained in:
Ng Wei Han 2023-11-14 20:10:41 +08:00 committed by larry.lx
parent 8e19728ea7
commit 3ce568ff44

@ -2355,7 +2355,7 @@ func tryMakeReadOnlyDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database
// If datadir doesn't exist we need to open db in write-mode // If datadir doesn't exist we need to open db in write-mode
// so database engine can create files. // so database engine can create files.
readonly := true readonly := true
if !common.FileExist(stack.ResolvePath("chaindata")) { if !common.FileExist(stack.ResolvePath("chaindata")) || ctx.Bool(PruneAncientDataFlag.Name) {
readonly = false readonly = false
} }
return MakeChainDatabase(ctx, stack, readonly, false) return MakeChainDatabase(ctx, stack, readonly, false)