cmd: apply snapshot cache flag

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-04-01 09:44:12 +08:00
parent cc273cef0b
commit f12af60780

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 {