diff options
author | Felix Lange <fjl@twurst.com> | 2017-03-18 07:55:37 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-03-18 08:05:28 +0800 |
commit | 24dd0355a34a40b1798c9b8bd97a7332a77e2556 (patch) | |
tree | 6eb22f45d051a3ba7aeeade24614dc2808b1b60e /pow/ethash_algo.go | |
parent | 61ede86737d57f62cb09de013191fc430d1dd3a2 (diff) | |
download | go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.tar go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.tar.gz go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.tar.bz2 go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.tar.lz go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.tar.xz go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.tar.zst go-tangerine-24dd0355a34a40b1798c9b8bd97a7332a77e2556.zip |
pow: fix Search with ethash test mode
The cache/dataset methods crashed with a nil pointer error if
cachesinmem/dagsinmem were zero. Fix it by skipping the eviction logic
if there are no caches/datasets.
Search always used the regular dataset size regardless of test mode. Fix
it by removing the redundant size parameter of hashimotoFull.
Fixes #3784
Diffstat (limited to 'pow/ethash_algo.go')
-rw-r--r-- | pow/ethash_algo.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pow/ethash_algo.go b/pow/ethash_algo.go index 3737cc5d7..1e996785f 100644 --- a/pow/ethash_algo.go +++ b/pow/ethash_algo.go @@ -349,12 +349,12 @@ func hashimotoLight(size uint64, cache []uint32, hash []byte, nonce uint64) ([]b // hashimotoFull aggregates data from the full dataset (using the full in-memory // dataset) in order to produce our final value for a particular header hash and // nonce. -func hashimotoFull(size uint64, dataset []uint32, hash []byte, nonce uint64) ([]byte, []byte) { +func hashimotoFull(dataset []uint32, hash []byte, nonce uint64) ([]byte, []byte) { lookup := func(index uint32) []uint32 { offset := index * hashWords return dataset[offset : offset+hashWords] } - return hashimoto(hash, nonce, size, lookup) + return hashimoto(hash, nonce, uint64(len(dataset))*4, lookup) } // datasetSizes is a lookup table for the ethash dataset size for the first 2048 |