From 94505146a21cc0aee16d79aebc17c8fcb1f91324 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 16 Mar 2015 23:17:28 +0100 Subject: updated vm env --- pow/block.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pow') diff --git a/pow/block.go b/pow/block.go index 136e4bf8d..9ae25bd4d 100644 --- a/pow/block.go +++ b/pow/block.go @@ -3,14 +3,15 @@ package pow import ( "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) type Block interface { Difficulty() *big.Int - HashNoNonce() []byte + HashNoNonce() common.Hash Nonce() uint64 - MixDigest() []byte + MixDigest() common.Hash NumberU64() uint64 } -- cgit v1.2.3 From 65eee2006d649b2b4f4fef9332d339444bb479b1 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 17 Mar 2015 12:01:21 +0100 Subject: pow/ezp: use common.Hash --- pow/ezp/pow.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'pow') diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go index 7eba95784..bd2927fe8 100644 --- a/pow/ezp/pow.go +++ b/pow/ezp/pow.go @@ -6,8 +6,8 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto/sha3" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/pow" ) @@ -83,17 +83,14 @@ func (pow *EasyPow) Verify(block pow.Block) bool { return Verify(block) } -func verify(hash []byte, diff *big.Int, nonce uint64) bool { +func verify(hash common.Hash, diff *big.Int, nonce uint64) bool { sha := sha3.NewKeccak256() - n := make([]byte, 8) binary.PutUvarint(n, nonce) - d := append(hash, n...) - sha.Write(d) - + sha.Write(n) + sha.Write(hash[:]) verification := new(big.Int).Div(common.BigPow(2, 256), diff) res := common.BigD(sha.Sum(nil)) - return res.Cmp(verification) <= 0 } -- cgit v1.2.3