Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove outdated prune-block/pruneancient tool, implement it by tail-deletion #2809

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
6 changes: 3 additions & 3 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,20 @@ func initGenesis(ctx *cli.Context) error {
overrides.OverrideVerkle = &v
}
name := "chaindata"
chaindb, err := stack.OpenDatabaseWithFreezer(name, 0, 0, ctx.String(utils.AncientFlag.Name), "", false, false, false, false)
chaindb, err := stack.OpenDatabaseWithFreezer(name, 0, 0, ctx.String(utils.AncientFlag.Name), "", false, false)
if err != nil {
utils.Fatalf("Failed to open database: %v", err)
}
defer chaindb.Close()

// if the trie data dir has been set, new trie db with a new state database
if ctx.IsSet(utils.MultiDataBaseFlag.Name) {
statediskdb, dbErr := stack.OpenDatabaseWithFreezer(name+"/state", 0, 0, "", "", false, false, false, false)
statediskdb, dbErr := stack.OpenDatabaseWithFreezer(name+"/state", 0, 0, "", "", false, false)
if dbErr != nil {
utils.Fatalf("Failed to open separate trie database: %v", dbErr)
}
chaindb.SetStateStore(statediskdb)
blockdb, err := stack.OpenDatabaseWithFreezer(name+"/block", 0, 0, "", "", false, false, false, false)
blockdb, err := stack.OpenDatabaseWithFreezer(name+"/block", 0, 0, "", "", false, false)
if err != nil {
utils.Fatalf("Failed to open separate block database: %v", err)
}
Expand Down
9 changes: 9 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
}
applyMetricConfig(ctx, &cfg)

// do some post loading config logic
if cfg.Eth.PruneAncientData {
if cfg.Eth.SyncMode != ethconfig.FullSync {
log.Warn("pruneancient parameter can only be used with syncmode=full, force to full sync")
cfg.Eth.SyncMode = ethconfig.FullSync
}
cfg.Eth.BlockHistory = params.FullImmutabilityThreshold
}

return stack, cfg
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ var (
utils.SnapshotFlag,
utils.TxLookupLimitFlag, // deprecated
utils.TransactionHistoryFlag,
utils.BlockHistoryFlag,
utils.StateHistoryFlag,
utils.PathDBSyncFlag,
utils.JournalFileFlag,
Expand All @@ -133,7 +134,7 @@ var (
utils.MultiDataBaseFlag,
utils.PersistDiffFlag,
utils.DiffBlockFlag,
utils.PruneAncientDataFlag,
utils.PruneAncientDataFlag, // deprecated
utils.CacheLogSizeFlag,
utils.FDLimitFlag,
utils.CryptoKZGFlag,
Expand Down Expand Up @@ -176,7 +177,6 @@ var (
utils.GpoMaxGasPriceFlag,
utils.GpoIgnoreGasPriceFlag,
configFileFlag,
utils.BlockAmountReserved,
utils.CheckSnapshotWithMPT,
utils.EnableDoubleSignMonitorFlag,
utils.VotingEnabledFlag,
Expand Down
259 changes: 0 additions & 259 deletions cmd/geth/pruneblock_test.go

This file was deleted.

Loading
Loading