Skip to content

Commit

Permalink
Downloader: fixed salt files (#12960)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored Dec 2, 2024
1 parent 2db7234 commit f3e31e8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions erigon-lib/downloader/snaptype/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ func ParseFileName(dir, fileName string) (res FileInfo, isE3Seedable bool, ok bo
return res, isStateFile, isStateFile
}

func isSaltFile(name string) bool {
return strings.HasPrefix(name, "salt")
}

func parseFileName(dir, fileName string) (res FileInfo, ok bool) {
ext := filepath.Ext(fileName)
onlyName := fileName[:len(fileName)-len(ext)]
Expand All @@ -139,10 +143,15 @@ func parseFileName(dir, fileName string) (res FileInfo, ok bool) {
if len(parts) < 2 {
return res, ok
}

res.Type, ok = ParseFileType(parts[len(parts)-1])
// This is a caplin hack - it is because with caplin state snapshots ok is always false
res.TypeString = parts[len(parts)-1]
if isSaltFile(fileName) {
// format for salt files is different: salt-<type>.txt
res.Type, ok = ParseFileType(parts[0])
res.TypeString = parts[0]
} else {
res.Type, ok = ParseFileType(parts[len(parts)-1])
// This is a caplin hack - it is because with caplin state snapshots ok is always false
res.TypeString = parts[len(parts)-1]
}

if ok {
res.TypeString = res.Type.Name()
Expand Down

0 comments on commit f3e31e8

Please sign in to comment.