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 lx
parent f7e9adc2c8
commit b494339e10

@ -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
// so database engine can create files.
readonly := true
if !common.FileExist(stack.ResolvePath("chaindata")) {
if !common.FileExist(stack.ResolvePath("chaindata")) || ctx.Bool(PruneAncientDataFlag.Name) {
readonly = false
}
return MakeChainDatabase(ctx, stack, readonly, false)