consensus/ethash: remove temp files created during DAG generation (#25381)
This makes it remove not only the actual DAG file, but also the temporary file which the DAG data is written to while generating.
This commit is contained in:
parent
c7ce74a53a
commit
6fdc619413
@ -278,8 +278,11 @@ func (c *cache) generate(dir string, limit int, lock bool, test bool) {
|
||||
// Iterate over all previous instances and delete old ones
|
||||
for ep := int(c.epoch) - limit; ep >= 0; ep-- {
|
||||
seed := seedHash(uint64(ep)*epochLength + 1)
|
||||
path := filepath.Join(dir, fmt.Sprintf("cache-R%d-%x%s", algorithmRevision, seed[:8], endian))
|
||||
os.Remove(path)
|
||||
path := filepath.Join(dir, fmt.Sprintf("cache-R%d-%x%s*", algorithmRevision, seed[:8], endian))
|
||||
files, _ := filepath.Glob(path) // find also the temp files that are generated.
|
||||
for _, file := range files {
|
||||
os.Remove(file)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user