From 2fefe4baa034927af0c815c9f317fefd95972298 Mon Sep 17 00:00:00 2001 From: Konrad Feldmeier Date: Thu, 8 Jun 2017 10:38:36 +0200 Subject: [PATCH] consensus: Fix `makedag` epoch `geth makedag ` was creating DAGs for `/ + 1`, hence it was impossible to create an epoch 0 DAG. This fixes the calculations in `consensus/ethash/ethash.go` for `MakeDataset` and `MakeCache`, and applies `gofmt`. --- consensus/ethash/ethash.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 94a9ea3326..7067e8643c 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -308,14 +308,14 @@ func (d *dataset) release() { // MakeCache generates a new ethash cache and optionally stores it to disk. func MakeCache(block uint64, dir string) { - c := cache{epoch: block/epochLength + 1} + c := cache{epoch: block / epochLength} c.generate(dir, math.MaxInt32, false) c.release() } // MakeDataset generates a new ethash dataset and optionally stores it to disk. func MakeDataset(block uint64, dir string) { - d := dataset{epoch: block/epochLength + 1} + d := dataset{epoch: block / epochLength} d.generate(dir, math.MaxInt32, false) d.release() }