Skip to content

Commit

Permalink
worker: return for resubmit signal.
Browse files Browse the repository at this point in the history
it is not necssary to add more transaction when resubmit is fired.
the resubmit logic was for PoW and can be removed later.
  • Loading branch information
setunapo committed Nov 21, 2022
1 parent 24976d0 commit 56684ed
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,16 +1016,19 @@ func (w *worker) fillTransactions(interruptCh chan int32, env *environment, stop
if len(localTxs) > 0 {
txs := types.NewTransactionsByPriceAndNonce(env.signer, localTxs, env.header.BaseFee)
err = w.commitTransactions(env, txs, interruptCh, stopTimer)
if err == errBlockInterruptedByNewHead || err == errBlockInterruptedByOutOfGas || err == errBlockInterruptedByTimeout {
// we will abort here when:
// 1.new block was imported
// 2.out of Gas, no more transaction can be added.
// 3.the mining timer has expired, stop adding transactions.
// 4.interrupted resubmit timer, which is by default 10s.
// resubmit is for PoW only, can be deleted for PoS consensus later
if err != nil {
return
}
}
if len(remoteTxs) > 0 {
txs := types.NewTransactionsByPriceAndNonce(env.signer, remoteTxs, env.header.BaseFee)
err = w.commitTransactions(env, txs, interruptCh, stopTimer)
if err == errBlockInterruptedByNewHead || err == errBlockInterruptedByOutOfGas || err == errBlockInterruptedByTimeout {
return
}
}

return
Expand Down

0 comments on commit 56684ed

Please sign in to comment.