aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-18 19:49:52 +0800
committerobscuren <geffobscura@gmail.com>2014-07-18 19:49:52 +0800
commitf702e27485981562ed7b88ecd3f8485af4c61b62 (patch)
tree5f5d40c0433ce4d9e99bfb801fe169cb74dfbf8a
parent0c5a747ef1e9f64f7c5627256b87ed47d23438db (diff)
downloadgo-tangerine-0.5.18.tar.gz
go-tangerine-0.5.18.tar.zst
go-tangerine-0.5.18.zip
Fixed miner stopping / starting:wq0.5.190.5.18
-rw-r--r--utils/cmd.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/cmd.go b/utils/cmd.go
index f4d613c29..5d0b3463c 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -247,7 +247,10 @@ func StartMining(ethereum *eth.Ethereum) bool {
addr := ethereum.KeyManager().Address()
go func() {
- miner = ethminer.NewDefaultMiner(addr, ethereum)
+ if miner == nil {
+ miner = ethminer.NewDefaultMiner(addr, ethereum)
+ }
+
// Give it some time to connect with peers
time.Sleep(3 * time.Second)
for !ethereum.IsUpToDate() {
@@ -255,7 +258,6 @@ func StartMining(ethereum *eth.Ethereum) bool {
}
logger.Infoln("Miner started")
- miner := ethminer.NewDefaultMiner(addr, ethereum)
miner.Start()
}()
RegisterInterrupt(func(os.Signal) {
@@ -269,10 +271,14 @@ func StartMining(ethereum *eth.Ethereum) bool {
func StopMining(ethereum *eth.Ethereum) bool {
if ethereum.Mining && miner != nil {
miner.Stop()
+
logger.Infoln("Miner stopped")
+
ethereum.Mining = false
+
return true
}
+
return false
}