Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov committed Nov 6, 2024
1 parent 7dc38c5 commit f41a78a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions erigon-lib/chain/snapcfg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,14 @@ func KnownCfg(networkName string) *Cfg {
return newCfg(networkName, c.Typed(knownTypes[networkName]))
}

func VersionedCfg(networkName string, preferred snaptype.Version, min snaptype.Version) *Cfg {
func VersionedCfg(networkName string, preferred snaptype.Version, _min snaptype.Version) *Cfg {
c, ok := knownPreverified[networkName]

if !ok {
return newCfg(networkName, Preverified{})
}

return newCfg(networkName, c.Versioned(preferred, min))
return newCfg(networkName, c.Versioned(preferred, _min))
}

var KnownWebseeds = map[string][]string{
Expand Down
4 changes: 0 additions & 4 deletions erigon-lib/seg/decompress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,6 @@ func generateRandWords() {
WORDS[N-1] = []byte{}
}

func randIntInRange(min, max int) int {
return (rand.Intn(max-min) + min)
}

func clearPrevDict() {
WORDS = [N][]byte{}
WORD_FLAGS = [N]bool{}
Expand Down
18 changes: 9 additions & 9 deletions eth/stagedsync/stage_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,25 +1040,25 @@ func (u *snapshotUploader) downloadLatestSnapshots(ctx context.Context, blockNum
}
}

var min uint64
var _min uint64

for _, info := range lastSegments {
if lastInfo, ok := info.Sys().(downloader.SnapInfo); ok {
if min == 0 || lastInfo.From() < min {
min = lastInfo.From()
if _min == 0 || lastInfo.From() < _min {
_min = lastInfo.From()
}
}
}

for segType, info := range lastSegments {
if lastInfo, ok := info.Sys().(downloader.SnapInfo); ok {
if lastInfo.From() > min {
if lastInfo.From() > _min {
for _, ent := range entries {
if info, err := ent.Info(); err == nil {
snapInfo, ok := info.Sys().(downloader.SnapInfo)

if ok && snapInfo.Type().Enum() == segType &&
snapInfo.From() == min {
snapInfo.From() == _min {
lastSegments[segType] = info
}
}
Expand Down Expand Up @@ -1088,17 +1088,17 @@ func (u *snapshotUploader) maxSeedableHeader() uint64 {
}

func (u *snapshotUploader) minBlockNumber() uint64 {
var min uint64
var _min uint64

if list, err := snaptype.Segments(u.cfg.dirs.Snap); err == nil {
for _, info := range list {
if u.seedable(info) && min == 0 || info.From < min {
min = info.From
if u.seedable(info) && _min == 0 || info.From < _min {
_min = info.From
}
}
}

return min
return _min
}

func expandHomeDir(dirpath string) string {
Expand Down

0 comments on commit f41a78a

Please sign in to comment.