aboutsummaryrefslogtreecommitdiffstats
path: root/pow/ethash_algo_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-23 16:56:12 +0800
committerGitHub <noreply@github.com>2017-03-23 16:56:12 +0800
commit61d2150a0750a554250c3bf090ef994be6c060f0 (patch)
tree56dd67f447fcc2992cf88ef68b074799f9c1468c /pow/ethash_algo_test.go
parent3fa0fa713bc1508835bdecd7dea78ff09803e327 (diff)
parent24dd0355a34a40b1798c9b8bd97a7332a77e2556 (diff)
downloaddexon-61d2150a0750a554250c3bf090ef994be6c060f0.tar
dexon-61d2150a0750a554250c3bf090ef994be6c060f0.tar.gz
dexon-61d2150a0750a554250c3bf090ef994be6c060f0.tar.bz2
dexon-61d2150a0750a554250c3bf090ef994be6c060f0.tar.lz
dexon-61d2150a0750a554250c3bf090ef994be6c060f0.tar.xz
dexon-61d2150a0750a554250c3bf090ef994be6c060f0.tar.zst
dexon-61d2150a0750a554250c3bf090ef994be6c060f0.zip
Merge pull request #3795 from fjl/pow-fix-test-mode
pow: fix Search with ethash test mode
Diffstat (limited to 'pow/ethash_algo_test.go')
-rw-r--r--pow/ethash_algo_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/pow/ethash_algo_test.go b/pow/ethash_algo_test.go
index c881874ff..0605d70ad 100644
--- a/pow/ethash_algo_test.go
+++ b/pow/ethash_algo_test.go
@@ -660,7 +660,7 @@ func TestHashimoto(t *testing.T) {
if !bytes.Equal(result, wantResult) {
t.Errorf("light hashimoto result mismatch: have %x, want %x", result, wantResult)
}
- digest, result = hashimotoFull(32*1024, dataset, hash, nonce)
+ digest, result = hashimotoFull(dataset, hash, nonce)
if !bytes.Equal(digest, wantDigest) {
t.Errorf("full hashimoto digest mismatch: have %x, want %x", digest, wantDigest)
}
@@ -713,6 +713,17 @@ func TestConcurrentDiskCacheGeneration(t *testing.T) {
pend.Wait()
}
+func TestTestMode(t *testing.T) {
+ head := &types.Header{Difficulty: big.NewInt(100)}
+ ethash := NewTestEthash()
+ nonce, mix := ethash.Search(types.NewBlockWithHeader(head), nil)
+ head.Nonce = types.EncodeNonce(nonce)
+ copy(head.MixDigest[:], mix)
+ if err := ethash.Verify(types.NewBlockWithHeader(head)); err != nil {
+ t.Error("unexpected Verify error:", err)
+ }
+}
+
// Benchmarks the cache generation performance.
func BenchmarkCacheGeneration(b *testing.B) {
for i := 0; i < b.N; i++ {
@@ -758,6 +769,6 @@ func BenchmarkHashimotoFullSmall(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
- hashimotoFull(32*65536, dataset, hash, 0)
+ hashimotoFull(dataset, hash, 0)
}
}