1
0
Fork 0
forked from forks/go-ethereum

cmd: apply snapshot cache flag in the MakeChain (#31534)

This commit is contained in:
Delweng 2025-04-01 20:10:22 +08:00 committed by GitHub
parent 1bd70ba57a
commit 4add312c8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2189,6 +2189,8 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
}
if !ctx.Bool(SnapshotFlag.Name) {
cache.SnapshotLimit = 0 // Disabled
} else if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) {
cache.SnapshotLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100
}
// If we're in readonly, do not bother generating snapshot data.
if readonly {