diff --git a/consensus/progpow/algorithm.go b/consensus/progpow/algorithm.go index 65578675d..7a7f985c1 100644 --- a/consensus/progpow/algorithm.go +++ b/consensus/progpow/algorithm.go @@ -19,7 +19,6 @@ package progpow import ( "encoding/binary" "hash" - "math" "math/big" "reflect" "runtime" @@ -35,20 +34,24 @@ import ( "github.com/dominant-strategies/go-quai/common/bitutil" "github.com/dominant-strategies/go-quai/crypto" "github.com/dominant-strategies/go-quai/log" + "github.com/dominant-strategies/go-quai/params" ) const ( - datasetInitBytes = 1 << 32 // Bytes in dataset at genesis - datasetGrowthBytes = 1 << 26 // Dataset growth per epoch - cacheInitBytes = 1 << 24 // Bytes in cache at genesis - cacheGrowthBytes = 1 << 21 // Cache growth per epoch - C_epochLength = math.MaxUint64 // Blocks per epoch - mixBytes = 128 // Width of mix - hashBytes = 64 // Hash length in bytes - hashWords = 16 // Number of 32 bit ints in a hash - datasetParents = 512 // Number of parents of each dataset element - cacheRounds = 3 // Number of rounds in cache production - loopAccesses = 64 // Number of accesses in hashimoto loop + datasetInitBytes = 1 << 32 // Bytes in dataset at genesis + datasetGrowthBytes = 1 << 26 // Dataset growth per epoch + cacheInitBytes = 1 << 24 // Bytes in cache at genesis + cacheGrowthBytes = 1 << 21 // Cache growth per epoch + mixBytes = 128 // Width of mix + hashBytes = 64 // Hash length in bytes + hashWords = 16 // Number of 32 bit ints in a hash + datasetParents = 512 // Number of parents of each dataset element + cacheRounds = 3 // Number of rounds in cache production + loopAccesses = 64 // Number of accesses in hashimoto loop +) + +var ( + C_epochLength = params.BlocksPerDay * 30 / 4 // 30 days worth of prime blocks ) // cacheSize returns the size of the ethash verification cache that belongs to a certain diff --git a/consensus/progpow/algorithm_progpow.go b/consensus/progpow/algorithm_progpow.go index d98417b7e..63a77a159 100644 --- a/consensus/progpow/algorithm_progpow.go +++ b/consensus/progpow/algorithm_progpow.go @@ -18,7 +18,6 @@ package progpow import ( "encoding/binary" - "math" "math/bits" goLRU "github.com/hashicorp/golang-lru/v2" @@ -33,7 +32,7 @@ const ( progpowDagLoads = 4 // Number of uint32 loads from the DAG per lane progpowCntCache = 11 progpowCntMath = 18 - progpowPeriodLength = math.MaxUint64 + progpowPeriodLength = 10 progpowCntDag = 64 progpowMixBytes = 256 )