aboutsummaryrefslogtreecommitdiffstats
path: root/pow
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-17 19:01:21 +0800
committerFelix Lange <fjl@twurst.com>2015-03-17 19:01:21 +0800
commit65eee2006d649b2b4f4fef9332d339444bb479b1 (patch)
tree6baefffe937ba9fcdbf5f4556d1927b8a51f5feb /pow
parent27f7aa01639696f4afa4233e0a301afafdd7b950 (diff)
downloadgo-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.tar
go-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.tar.gz
go-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.tar.bz2
go-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.tar.lz
go-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.tar.xz
go-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.tar.zst
go-tangerine-65eee2006d649b2b4f4fef9332d339444bb479b1.zip
pow/ezp: use common.Hash
Diffstat (limited to 'pow')
-rw-r--r--pow/ezp/pow.go11
1 files changed, 4 insertions, 7 deletions
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
}