diff options
Diffstat (limited to 'pow/ethash_algo.go')
-rw-r--r-- | pow/ethash_algo.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/pow/ethash_algo.go b/pow/ethash_algo.go index f6d05880a..d3fac8d5b 100644 --- a/pow/ethash_algo.go +++ b/pow/ethash_algo.go @@ -19,7 +19,6 @@ package pow import ( "encoding/binary" "io" - "math/big" "runtime" "sync" "sync/atomic" @@ -45,42 +44,6 @@ const ( loopAccesses = 64 // Number of accesses in hashimoto loop ) -// cacheSize calculates and returns the size of the ethash verification cache that -// belongs to a certain block number. The cache size grows linearly, however, we -// always take the highest prime below the linearly growing threshold in order to -// reduce the risk of accidental regularities leading to cyclic behavior. -func cacheSize(block uint64) uint64 { - // If we have a pre-generated value, use that - epoch := int(block / epochLength) - if epoch < len(cacheSizes) { - return cacheSizes[epoch] - } - // No known cache size, calculate manually (sanity branch only) - size := uint64(cacheInitBytes + cacheGrowthBytes*epoch - hashBytes) - for !new(big.Int).SetUint64(size / hashBytes).ProbablyPrime(1) { // Always accurate for n < 2^64 - size -= 2 * hashBytes - } - return size -} - -// datasetSize calculates and returns the size of the ethash mining dataset that -// belongs to a certain block number. The dataset size grows linearly, however, we -// always take the highest prime below the linearly growing threshold in order to -// reduce the risk of accidental regularities leading to cyclic behavior. -func datasetSize(block uint64) uint64 { - // If we have a pre-generated value, use that - epoch := int(block / epochLength) - if epoch < len(datasetSizes) { - return datasetSizes[epoch] - } - // No known dataset size, calculate manually (sanity branch only) - size := uint64(datasetInitBytes + datasetGrowthBytes*epoch - mixBytes) - for !new(big.Int).SetUint64(size / mixBytes).ProbablyPrime(1) { // Always accurate for n < 2^64 - size -= 2 * mixBytes - } - return size -} - // seedHash is the seed to use for generating a verification cache and the mining // dataset. func seedHash(block uint64) []byte { |