Merge pull request #14598 from konradkonrad/fix_makedag

consensus/ethash, cmd/geth: Fix `makedag` epoch
This commit is contained in:
Péter Szilágyi 2017-06-12 13:34:26 +03:00 committed by GitHub
commit e3dfd55820

View File

@ -308,14 +308,14 @@ func (d *dataset) release() {
// MakeCache generates a new ethash cache and optionally stores it to disk. // MakeCache generates a new ethash cache and optionally stores it to disk.
func MakeCache(block uint64, dir string) { func MakeCache(block uint64, dir string) {
c := cache{epoch: block/epochLength + 1} c := cache{epoch: block / epochLength}
c.generate(dir, math.MaxInt32, false) c.generate(dir, math.MaxInt32, false)
c.release() c.release()
} }
// MakeDataset generates a new ethash dataset and optionally stores it to disk. // MakeDataset generates a new ethash dataset and optionally stores it to disk.
func MakeDataset(block uint64, dir string) { func MakeDataset(block uint64, dir string) {
d := dataset{epoch: block/epochLength + 1} d := dataset{epoch: block / epochLength}
d.generate(dir, math.MaxInt32, false) d.generate(dir, math.MaxInt32, false)
d.release() d.release()
} }