aboutsummaryrefslogtreecommitdiffstats
path: root/consensus
diff options
context:
space:
mode:
authorKonrad Feldmeier <konrad@brainbot.com>2017-06-08 16:38:36 +0800
committerKonrad Feldmeier <konrad@brainbot.com>2017-06-12 17:15:16 +0800
commit2fefe4baa034927af0c815c9f317fefd95972298 (patch)
tree3ae9eec6ff477e75c67442552927898f238e4e11 /consensus
parent80f7c6c2996ad47f70a5070c400b1fd87a20c59c (diff)
downloadgo-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.tar
go-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.tar.gz
go-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.tar.bz2
go-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.tar.lz
go-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.tar.xz
go-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.tar.zst
go-tangerine-2fefe4baa034927af0c815c9f317fefd95972298.zip
consensus: Fix `makedag` epoch
`geth makedag <blocknumber> <path>` was creating DAGs for `<blocknumber>/<epoch_length> + 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`.
Diffstat (limited to 'consensus')
-rw-r--r--consensus/ethash/ethash.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go
index 94a9ea332..7067e8643 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()
}