aboutsummaryrefslogtreecommitdiffstats
path: root/pow
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-05 10:26:23 +0800
committerobscuren <geffobscura@gmail.com>2015-02-05 10:26:23 +0800
commita1b4547a53c4c738e435c1968c1e606935912e47 (patch)
tree0e37738e24db81d48825f80076d942b6da9522c7 /pow
parent57f95c1dc7f2e3412d7d78cfdab7074ce1dbbf09 (diff)
downloaddexon-a1b4547a53c4c738e435c1968c1e606935912e47.tar
dexon-a1b4547a53c4c738e435c1968c1e606935912e47.tar.gz
dexon-a1b4547a53c4c738e435c1968c1e606935912e47.tar.bz2
dexon-a1b4547a53c4c738e435c1968c1e606935912e47.tar.lz
dexon-a1b4547a53c4c738e435c1968c1e606935912e47.tar.xz
dexon-a1b4547a53c4c738e435c1968c1e606935912e47.tar.zst
dexon-a1b4547a53c4c738e435c1968c1e606935912e47.zip
set uncles regardless of empty uncle list. Fixes invalid blocks being mined
Diffstat (limited to 'pow')
-rw-r--r--pow/ezp/pow.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go
index 64d3230c9..2791c4b0b 100644
--- a/pow/ezp/pow.go
+++ b/pow/ezp/pow.go
@@ -1,6 +1,7 @@
package ezp
import (
+ "fmt"
"math/big"
"math/rand"
"time"
@@ -53,13 +54,13 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
elapsed := time.Now().UnixNano() - start
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000
pow.HashRate = int64(hashes)
- //powlogger.Infoln("Hashing @", pow.HashRate, "khash")
t = time.Now()
}
sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes())
if verify(hash, diff, sha) {
+ fmt.Printf("HASH: %x\nDIFF %v\nSHA %x\n", hash, diff, sha)
return sha
}
}
@@ -83,7 +84,7 @@ func verify(hash []byte, diff *big.Int, nonce []byte) bool {
sha.Write(d)
verification := new(big.Int).Div(ethutil.BigPow(2, 256), diff)
- res := ethutil.U256(ethutil.BigD(sha.Sum(nil)))
+ res := ethutil.BigD(sha.Sum(nil))
return res.Cmp(verification) <= 0
}