aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go')
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
index e6833e343..1e1de989d 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/crypto"
)
func init() {
@@ -59,6 +60,14 @@ var validBlocks = []*testBlock{
},
}
+var invalidZeroDiffBlock = testBlock{
+ number: 61440000,
+ hashNoNonce: crypto.Sha3Hash([]byte("foo")),
+ difficulty: big.NewInt(0),
+ nonce: 0xcafebabec00000fe,
+ mixDigest: crypto.Sha3Hash([]byte("bar")),
+}
+
func TestEthashVerifyValid(t *testing.T) {
eth := New()
for i, block := range validBlocks {
@@ -68,6 +77,13 @@ func TestEthashVerifyValid(t *testing.T) {
}
}
+func TestEthashVerifyInvalid(t *testing.T) {
+ eth := New()
+ if eth.Verify(&invalidZeroDiffBlock) {
+ t.Errorf("should not validate - we just ensure it does not panic on this block")
+ }
+}
+
func TestEthashConcurrentVerify(t *testing.T) {
eth, err := NewForTesting()
if err != nil {