Skip to content

Commit 9be7853

Browse files
committed
Fixed issues with stalled remote miner
1 parent dc3a937 commit 9be7853

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎miner/remote_agent.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type RemoteAgent struct {
1717

1818
func NewRemoteAgent() *RemoteAgent {
1919
agent := &RemoteAgent{}
20-
go agent.run()
2120

2221
return agent
2322
}
@@ -33,6 +32,7 @@ func (a *RemoteAgent) SetWorkCh(returnCh chan<- Work) {
3332
func (a *RemoteAgent) Start() {
3433
a.quit = make(chan struct{})
3534
a.workCh = make(chan *types.Block, 1)
35+
go a.run()
3636
}
3737

3838
func (a *RemoteAgent) Stop() {

‎miner/worker.go‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ func (self *worker) commitNewWork() {
213213
transactions := self.eth.TxPool().GetTransactions()
214214
sort.Sort(types.TxByNonce{transactions})
215215

216-
minerlogger.Infof("committing new work with %d txs\n", len(transactions))
217216
// Keep track of transactions which return errors so they can be removed
218-
var remove types.Transactions
217+
var (
218+
remove types.Transactions
219+
tcount = 0
220+
)
219221
gasLimit:
220222
for i, tx := range transactions {
221223
err := self.commitTransaction(tx)
@@ -233,6 +235,8 @@ gasLimit:
233235
minerlogger.Infof("Gas limit reached for block. %d TXs included in this block\n", i)
234236
// Break on gas limit
235237
break gasLimit
238+
default:
239+
tcount++
236240
}
237241
}
238242
self.eth.TxPool().RemoveSet(remove)
@@ -251,7 +255,8 @@ gasLimit:
251255
uncles = append(uncles, uncle.Header())
252256
}
253257
}
254-
minerlogger.Infoln("Included", len(uncles), "uncle(s)")
258+
minerlogger.Infof("commit new work with %d txs & %d uncles\n", tcount, len(uncles))
259+
255260
self.current.block.SetUncles(uncles)
256261

257262
self.current.state.AddBalance(self.coinbase, core.BlockReward)

0 commit comments

Comments
 (0)