aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/dagger.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <obscuren@users.noreply.github.com>2014-10-17 23:10:34 +0800
committerJeffrey Wilcke <obscuren@users.noreply.github.com>2014-10-17 23:10:34 +0800
commitdf2b70853ff0764c4fcb181547eee3a66f7bda4a (patch)
treea70bf06660283bcc83f6a499cf9fed808d347a06 /ethchain/dagger.go
parent3b709852846317d3456f55f906afc327ba76d6df (diff)
parentfa84e50ddb8e64d4cb92d58e235cfed13761f21e (diff)
downloaddexon-df2b70853ff0764c4fcb181547eee3a66f7bda4a.tar.gz
dexon-df2b70853ff0764c4fcb181547eee3a66f7bda4a.tar.zst
dexon-df2b70853ff0764c4fcb181547eee3a66f7bda4a.zip
Merge pull request #58 from fjl/feature/event
Blocking event package
Diffstat (limited to 'ethchain/dagger.go')
-rw-r--r--ethchain/dagger.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/ethchain/dagger.go b/ethchain/dagger.go
index 916d7e9c8..2d2b5720f 100644
--- a/ethchain/dagger.go
+++ b/ethchain/dagger.go
@@ -8,7 +8,6 @@ import (
"github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethlog"
- "github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/sha3"
)
@@ -16,7 +15,7 @@ import (
var powlogger = ethlog.NewLogger("POW")
type PoW interface {
- Search(block *Block, reactChan chan ethreact.Event) []byte
+ Search(block *Block, stop <-chan struct{}) []byte
Verify(hash []byte, diff *big.Int, nonce []byte) bool
GetHashrate() int64
Turbo(bool)
@@ -36,7 +35,7 @@ func (pow *EasyPow) Turbo(on bool) {
pow.turbo = on
}
-func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
+func (pow *EasyPow) Search(block *Block, stop <-chan struct{}) []byte {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
hash := block.HashNoNonce()
diff := block.Difficulty
@@ -46,7 +45,7 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
for {
select {
- case <-reactChan:
+ case <-stop:
powlogger.Infoln("Breaking from mining")
return nil
default: