aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-25 17:06:06 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-25 17:06:06 +0800
commit8774fdcd64ffe55bbd5d47cd1479a626506d8f01 (patch)
tree2663f232b680b7871bed549b6b4ae67ab8eca604 /Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
parent22c7ce0162f2d14a7340e00e93697780c91d2087 (diff)
parent8363aba7acaab4379a3461cfc3b7b35e8436693f (diff)
downloadgo-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.tar
go-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.tar.gz
go-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.tar.bz2
go-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.tar.lz
go-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.tar.xz
go-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.tar.zst
go-tangerine-8774fdcd64ffe55bbd5d47cd1479a626506d8f01.zip
Merge pull request #1329 from Gustav-Simonsson/ethash_input_validations
Update Ethash Godeps
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 {