aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-27 01:45:57 +0800
committerzelig <viktor.tron@gmail.com>2014-06-27 01:45:57 +0800
commit853053a3b204ddf4ae935e70e0aa5b5d8994493e (patch)
tree8e86c3aa0f913288f2a789c3517444e6fe0583b9 /ethminer
parentda38faa8f7c0f2a6620b54e46fc38a201845e104 (diff)
downloadgo-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.tar
go-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.tar.gz
go-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.tar.bz2
go-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.tar.lz
go-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.tar.xz
go-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.tar.zst
go-tangerine-853053a3b204ddf4ae935e70e0aa5b5d8994493e.zip
go fmt
Diffstat (limited to 'ethminer')
-rw-r--r--ethminer/miner.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go
index 2c1645672..66388723e 100644
--- a/ethminer/miner.go
+++ b/ethminer/miner.go
@@ -3,9 +3,9 @@ package ethminer
import (
"bytes"
"github.com/ethereum/eth-go/ethchain"
+ "github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
- "github.com/ethereum/eth-go/ethlog"
"sort"
)
@@ -57,18 +57,23 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) Miner {
return miner
}
+
func (miner *Miner) Start() {
// Prepare inital block
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
go miner.listener()
+ logger.Infoln("Started")
}
+
func (miner *Miner) listener() {
out:
for {
select {
case <-miner.quitChan:
+ logger.Infoln("Stopped")
break out
case chanMessage := <-miner.reactChan:
+
if block, ok := chanMessage.Resource.(*ethchain.Block); ok {
//logger.Infoln("Got new block via Reactor")
if bytes.Compare(miner.ethereum.BlockChain().CurrentBlock.Hash(), block.Hash()) == 0 {
@@ -123,8 +128,9 @@ out:
}
func (self *Miner) Stop() {
- self.powQuitChan <- ethutil.React{}
+ logger.Infoln("Stopping...")
self.quitChan <- true
+ self.powQuitChan <- ethutil.React{}
}
func (self *Miner) mineNewBlock() {