Merge pull request #22280 from karalabe/snapshot-default

cmd/utils: enable snapshots by default
This commit is contained in:
Péter Szilágyi 2021-02-08 12:58:54 +02:00 committed by GitHub
commit bbe694fc52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -208,9 +208,9 @@ var (
Usage: `Blockchain garbage collection mode ("full", "archive")`, Usage: `Blockchain garbage collection mode ("full", "archive")`,
Value: "full", Value: "full",
} }
SnapshotFlag = cli.BoolFlag{ SnapshotFlag = cli.BoolTFlag{
Name: "snapshot", Name: "snapshot",
Usage: `Enables snapshot-database mode -- experimental work in progress feature`, Usage: `Enables snapshot-database mode (default = enable)`,
} }
TxLookupLimitFlag = cli.Int64Flag{ TxLookupLimitFlag = cli.Int64Flag{
Name: "txlookuplimit", Name: "txlookuplimit",
@ -1579,7 +1579,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheSnapshotFlag.Name) { if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheSnapshotFlag.Name) {
cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100 cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100
} }
if !ctx.GlobalIsSet(SnapshotFlag.Name) { if !ctx.GlobalBool(SnapshotFlag.Name) {
// If snap-sync is requested, this flag is also required // If snap-sync is requested, this flag is also required
if cfg.SyncMode == downloader.SnapSync { if cfg.SyncMode == downloader.SnapSync {
log.Info("Snap sync requested, enabling --snapshot") log.Info("Snap sync requested, enabling --snapshot")
@ -1893,7 +1893,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readOnly bool) (chain *core.B
cache.Preimages = true cache.Preimages = true
log.Info("Enabling recording of key preimages since archive mode is used") log.Info("Enabling recording of key preimages since archive mode is used")
} }
if !ctx.GlobalIsSet(SnapshotFlag.Name) { if !ctx.GlobalBool(SnapshotFlag.Name) {
cache.SnapshotLimit = 0 // Disabled cache.SnapshotLimit = 0 // Disabled
} }
if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) { if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) {