Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 committed Dec 13, 2024
1 parent a7e1426 commit 63de388
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
7 changes: 7 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,11 @@ var (
Name: ethconfig.FlagSnapStateStop,
Usage: "Workaround to stop producing new state files, if you meet some state-related critical bug. It will stop aggregate DB history in a state files. DB will grow and may slightly slow-down - and removing this flag in future will not fix this effect (db size will not greatly reduce).",
}
SnapSkipStateSnapshotDownloadFlag = cli.BoolFlag{
Name: "snap.skip-state-snapshot-download",
Usage: "Skip state download and start from genesis block",
Value: false,
}
TorrentVerbosityFlag = cli.IntFlag{
Name: "torrent.verbosity",
Value: 2,
Expand Down Expand Up @@ -766,6 +771,7 @@ var (
Usage: "Enable WRITE_MAP feature for fast database writes and fast commit times",
Value: true,
}

HealthCheckFlag = cli.BoolFlag{
Name: "healthcheck",
Usage: "Enabling grpc health check",
Expand Down Expand Up @@ -1872,6 +1878,7 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *nodecfg.Config, cfg *ethconfig.C
cfg.Snapshot.KeepBlocks = ctx.Bool(SnapKeepBlocksFlag.Name)
cfg.Snapshot.ProduceE2 = !ctx.Bool(SnapStopFlag.Name)
cfg.Snapshot.ProduceE3 = !ctx.Bool(SnapStateStopFlag.Name)
cfg.Snapshot.DisableDownloadE3 = ctx.Bool(SnapSkipStateSnapshotDownloadFlag.Name)
cfg.Snapshot.NoDownloader = ctx.Bool(NoDownloaderFlag.Name)
cfg.Snapshot.Verify = ctx.Bool(DownloaderVerifyFlag.Name)
cfg.Snapshot.DownloaderAddr = strings.TrimSpace(ctx.String(DownloaderAddrFlag.Name))
Expand Down
15 changes: 8 additions & 7 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ func init() {
//go:generate gencodec -dir . -type Config -formats toml -out gen_config.go

type BlocksFreezing struct {
KeepBlocks bool // produce new snapshots of blocks but don't remove blocks from DB
ProduceE2 bool // produce new block files
ProduceE3 bool // produce new state files
NoDownloader bool // possible to use snapshots without calling Downloader
Verify bool // verify snapshots on startup
DownloaderAddr string
ChainName string
KeepBlocks bool // produce new snapshots of blocks but don't remove blocks from DB
ProduceE2 bool // produce new block files
ProduceE3 bool // produce new state files
NoDownloader bool // possible to use snapshots without calling Downloader
Verify bool // verify snapshots on startup
DisableDownloadE3 bool // disable download state snapshots
DownloaderAddr string
ChainName string
}

func (s BlocksFreezing) String() string {
Expand Down
6 changes: 5 additions & 1 deletion turbo/snapshotsync/snapshotsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func adjustBlockPrune(blocks, minBlocksToDownload uint64) uint64 {
return blocks - blocks%snaptype.Erigon2MergeLimit
}

func shouldUseStepsForPruning(name string) bool {
func isStateSnapshot(name string) bool {
return strings.HasPrefix(name, "idx") || strings.HasPrefix(name, "history") || strings.HasPrefix(name, "accessor")
}

Expand Down Expand Up @@ -337,6 +337,10 @@ func WaitForDownloader(ctx context.Context, logPrefix string, dirs datadir.Dirs,
if caplin == OnlyCaplin && !strings.Contains(p.Name, "beaconblocks") && !strings.Contains(p.Name, "blobsidecars") && !strings.Contains(p.Name, "caplin") {
continue
}

if isStateSnapshot(p.Name) && blockReader.FreezingCfg().DisableDownloadE3 {
continue
}
if !blobs && strings.Contains(p.Name, "blobsidecars") {
continue
}
Expand Down

0 comments on commit 63de388

Please sign in to comment.