Skip to content

Commit 65eee20

Browse files
committed
pow/ezp: use common.Hash
1 parent 27f7aa0 commit 65eee20

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎pow/ezp/pow.go‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"math/rand"
77
"time"
88

9-
"github.com/ethereum/go-ethereum/crypto/sha3"
109
"github.com/ethereum/go-ethereum/common"
10+
"github.com/ethereum/go-ethereum/crypto/sha3"
1111
"github.com/ethereum/go-ethereum/logger"
1212
"github.com/ethereum/go-ethereum/pow"
1313
)
@@ -83,17 +83,14 @@ func (pow *EasyPow) Verify(block pow.Block) bool {
8383
return Verify(block)
8484
}
8585

86-
func verify(hash []byte, diff *big.Int, nonce uint64) bool {
86+
func verify(hash common.Hash, diff *big.Int, nonce uint64) bool {
8787
sha := sha3.NewKeccak256()
88-
8988
n := make([]byte, 8)
9089
binary.PutUvarint(n, nonce)
91-
d := append(hash, n...)
92-
sha.Write(d)
93-
90+
sha.Write(n)
91+
sha.Write(hash[:])
9492
verification := new(big.Int).Div(common.BigPow(2, 256), diff)
9593
res := common.BigD(sha.Sum(nil))
96-
9794
return res.Cmp(verification) <= 0
9895
}
9996

0 commit comments

Comments
 (0)