diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-23 23:35:44 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-23 23:35:44 +0800 |
commit | 9be7853e349f97917120fd925e2c5a462bd78846 (patch) | |
tree | b194545cd7b8ee45eaddb17553cab02c07bd2610 | |
parent | dc3a9379f50d0d5b41abc28acc2a871534968a77 (diff) | |
download | go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.tar go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.tar.gz go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.tar.bz2 go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.tar.lz go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.tar.xz go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.tar.zst go-tangerine-9be7853e349f97917120fd925e2c5a462bd78846.zip |
Fixed issues with stalled remote miner
-rw-r--r-- | miner/remote_agent.go | 2 | ||||
-rw-r--r-- | miner/worker.go | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/miner/remote_agent.go b/miner/remote_agent.go index 8ea164f34..3911ac61e 100644 --- a/miner/remote_agent.go +++ b/miner/remote_agent.go @@ -17,7 +17,6 @@ type RemoteAgent struct { func NewRemoteAgent() *RemoteAgent { agent := &RemoteAgent{} - go agent.run() return agent } @@ -33,6 +32,7 @@ func (a *RemoteAgent) SetWorkCh(returnCh chan<- Work) { func (a *RemoteAgent) Start() { a.quit = make(chan struct{}) a.workCh = make(chan *types.Block, 1) + go a.run() } func (a *RemoteAgent) Stop() { diff --git a/miner/worker.go b/miner/worker.go index ff500b156..587036f22 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -213,9 +213,11 @@ func (self *worker) commitNewWork() { transactions := self.eth.TxPool().GetTransactions() sort.Sort(types.TxByNonce{transactions}) - minerlogger.Infof("committing new work with %d txs\n", len(transactions)) // Keep track of transactions which return errors so they can be removed - var remove types.Transactions + var ( + remove types.Transactions + tcount = 0 + ) gasLimit: for i, tx := range transactions { err := self.commitTransaction(tx) @@ -233,6 +235,8 @@ gasLimit: minerlogger.Infof("Gas limit reached for block. %d TXs included in this block\n", i) // Break on gas limit break gasLimit + default: + tcount++ } } self.eth.TxPool().RemoveSet(remove) @@ -251,7 +255,8 @@ gasLimit: uncles = append(uncles, uncle.Header()) } } - minerlogger.Infoln("Included", len(uncles), "uncle(s)") + minerlogger.Infof("commit new work with %d txs & %d uncles\n", tcount, len(uncles)) + self.current.block.SetUncles(uncles) self.current.state.AddBalance(self.coinbase, core.BlockReward) |