提交 9be7853e 编写于 作者: O obscuren

Fixed issues with stalled remote miner

上级 dc3a9379
...@@ -17,7 +17,6 @@ type RemoteAgent struct { ...@@ -17,7 +17,6 @@ type RemoteAgent struct {
func NewRemoteAgent() *RemoteAgent { func NewRemoteAgent() *RemoteAgent {
agent := &RemoteAgent{} agent := &RemoteAgent{}
go agent.run()
return agent return agent
} }
...@@ -33,6 +32,7 @@ func (a *RemoteAgent) SetWorkCh(returnCh chan<- Work) { ...@@ -33,6 +32,7 @@ func (a *RemoteAgent) SetWorkCh(returnCh chan<- Work) {
func (a *RemoteAgent) Start() { func (a *RemoteAgent) Start() {
a.quit = make(chan struct{}) a.quit = make(chan struct{})
a.workCh = make(chan *types.Block, 1) a.workCh = make(chan *types.Block, 1)
go a.run()
} }
func (a *RemoteAgent) Stop() { func (a *RemoteAgent) Stop() {
......
...@@ -213,9 +213,11 @@ func (self *worker) commitNewWork() { ...@@ -213,9 +213,11 @@ func (self *worker) commitNewWork() {
transactions := self.eth.TxPool().GetTransactions() transactions := self.eth.TxPool().GetTransactions()
sort.Sort(types.TxByNonce{transactions}) 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 // Keep track of transactions which return errors so they can be removed
var remove types.Transactions var (
remove types.Transactions
tcount = 0
)
gasLimit: gasLimit:
for i, tx := range transactions { for i, tx := range transactions {
err := self.commitTransaction(tx) err := self.commitTransaction(tx)
...@@ -233,6 +235,8 @@ gasLimit: ...@@ -233,6 +235,8 @@ gasLimit:
minerlogger.Infof("Gas limit reached for block. %d TXs included in this block\n", i) minerlogger.Infof("Gas limit reached for block. %d TXs included in this block\n", i)
// Break on gas limit // Break on gas limit
break gasLimit break gasLimit
default:
tcount++
} }
} }
self.eth.TxPool().RemoveSet(remove) self.eth.TxPool().RemoveSet(remove)
...@@ -251,7 +255,8 @@ gasLimit: ...@@ -251,7 +255,8 @@ gasLimit:
uncles = append(uncles, uncle.Header()) 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.block.SetUncles(uncles)
self.current.state.AddBalance(self.coinbase, core.BlockReward) self.current.state.AddBalance(self.coinbase, core.BlockReward)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册