aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/dagger.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/dagger.go')
-rw-r--r--ethchain/dagger.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/ethchain/dagger.go b/ethchain/dagger.go
index 565e1e447..08c4826db 100644
--- a/ethchain/dagger.go
+++ b/ethchain/dagger.go
@@ -1,15 +1,17 @@
package ethchain
import (
+ "github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/sha3"
"hash"
- "log"
"math/big"
"math/rand"
"time"
)
+var powlogger = ethlog.NewLogger("POW")
+
type PoW interface {
Search(block *Block, reactChan chan ethutil.React) []byte
Verify(hash []byte, diff *big.Int, nonce []byte) bool
@@ -29,14 +31,13 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethutil.React) []byte {
for {
select {
case <-reactChan:
- //ethutil.Config.Log.Infoln("[POW] Received reactor event; breaking out.")
return nil
default:
i++
if i%1234567 == 0 {
elapsed := time.Now().UnixNano() - start
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000
- ethutil.Config.Log.Infoln("[POW] Hashing @", int64(hashes), "khash")
+ powlogger.Infoln("Hashing @", int64(hashes), "khash")
}
sha := ethutil.Sha3Bin(big.NewInt(r.Int63()).Bytes())
@@ -81,7 +82,7 @@ func (dag *Dagger) Find(obj *big.Int, resChan chan int64) {
rnd := r.Int63()
res := dag.Eval(big.NewInt(rnd))
- log.Printf("rnd %v\nres %v\nobj %v\n", rnd, res, obj)
+ powlogger.Infof("rnd %v\nres %v\nobj %v\n", rnd, res, obj)
if res.Cmp(obj) < 0 {
// Post back result on the channel
resChan <- rnd