OSDN Git Service

Bvm (#100)
authorPaladz <yzhu101@uottawa.ca>
Mon, 13 Nov 2017 09:04:37 +0000 (17:04 +0800)
committerGuanghua Guo <1536310027@qq.com>
Mon, 13 Nov 2017 09:04:37 +0000 (17:04 +0800)
* chain.state using block.height instead of height

* define the template structure for coinbase transaction

* fix for code review, golint and elegant

* fix a acp key error

* fix for hsm_test bug

* fix bug for list account

* fix for code review

* add log info to mining

blockchain/reactor.go
mining/cpuminer/cpuminer.go

index 3878dbe..5acf68d 100644 (file)
@@ -240,6 +240,7 @@ func NewBlockchainReactor(chain *protocol.Chain, txPool *protocol.TxPool, accoun
 func (bcR *BlockchainReactor) OnStart() error {
        bcR.BaseReactor.OnStart()
        bcR.BuildHander()
+
        bcR.mining.Start()
        go bcR.syncRoutine()
        return nil
@@ -248,6 +249,7 @@ func (bcR *BlockchainReactor) OnStart() error {
 // OnStop implements BaseService
 func (bcR *BlockchainReactor) OnStop() {
        bcR.BaseReactor.OnStop()
+       bcR.mining.Stop()
 }
 
 // GetChannels implements Reactor
index dbd660c..4ead54a 100644 (file)
@@ -189,10 +189,11 @@ func (m *CPUMiner) Start() {
 
        m.quit = make(chan struct{})
        m.speedMonitorQuit = make(chan struct{})
-       m.wg.Add(2)
+       m.wg.Add(1)
        go m.miningWorkerController()
 
        m.started = true
+       log.Infof("CPU miner started")
 }
 
 // Stop gracefully stops the mining process by signalling all workers, and the
@@ -213,6 +214,7 @@ func (m *CPUMiner) Stop() {
        close(m.quit)
        m.wg.Wait()
        m.started = false
+       log.Info("CPU miner stopped")
 }
 
 // IsMining returns whether or not the CPU miner has been started and is