aboutsummaryrefslogtreecommitdiffstats
path: root/pow
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-15 18:37:23 +0800
committerobscuren <geffobscura@gmail.com>2014-12-15 18:38:09 +0800
commitf111fc060884d69fbe46066b9ccae4c9aa5da890 (patch)
tree8b64b989135084d21221df79f21909e1f38db08f /pow
parent1d959cb0ca38079f5d50ece7eb0a8405f423ad6e (diff)
downloaddexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.tar
dexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.tar.gz
dexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.tar.bz2
dexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.tar.lz
dexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.tar.xz
dexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.tar.zst
dexon-f111fc060884d69fbe46066b9ccae4c9aa5da890.zip
WIP
Diffstat (limited to 'pow')
-rw-r--r--pow/ezp/pow.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go
index cdf89950f..b4f863cb6 100644
--- a/pow/ezp/pow.go
+++ b/pow/ezp/pow.go
@@ -59,7 +59,7 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
}
sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes())
- if pow.verify(hash, diff, sha) {
+ if verify(hash, diff, sha) {
return sha
}
}
@@ -72,7 +72,11 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
return nil
}
-func (pow *EasyPow) verify(hash []byte, diff *big.Int, nonce []byte) bool {
+func (pow *EasyPow) Verify(block pow.Block) bool {
+ return Verify(block)
+}
+
+func verify(hash []byte, diff *big.Int, nonce []byte) bool {
sha := sha3.NewKeccak256()
d := append(hash, nonce...)
@@ -84,6 +88,6 @@ func (pow *EasyPow) verify(hash []byte, diff *big.Int, nonce []byte) bool {
return res.Cmp(verification) <= 0
}
-func (pow *EasyPow) Verify(block pow.Block) bool {
- return pow.verify(block.HashNoNonce(), block.Diff(), block.N())
+func Verify(block pow.Block) bool {
+ return verify(block.HashNoNonce(), block.Diff(), block.N())
}