diff options
author | Felix Lange <fjl@twurst.com> | 2014-10-14 07:58:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2014-10-17 00:50:48 +0800 |
commit | 36cdab206849c7e363e0b9911553098c3e8ca644 (patch) | |
tree | 5cf4093f0531b435e7dc4092953a60903d837429 /ethchain/dagger.go | |
parent | 690690489610352d43f8547744b6c9486ad5affa (diff) | |
download | go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.tar go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.tar.gz go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.tar.bz2 go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.tar.lz go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.tar.xz go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.tar.zst go-tangerine-36cdab206849c7e363e0b9911553098c3e8ca644.zip |
all: use (blocking) event package instead of ethreact
Diffstat (limited to 'ethchain/dagger.go')
-rw-r--r-- | ethchain/dagger.go | 7 |
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: |