Skip to content

Commit

Permalink
miner/worker: skip resubmit logic in Consortium
Browse files Browse the repository at this point in the history
Currently, after 3 seconds, worker tries to create another block, optimistically
thinks that it can get more transactions and earns more fee as a result.
However, this causes overhead to the main block creating flow, so skip this
logic in Consortium.
  • Loading branch information
minh-bq committed Feb 22, 2024
1 parent 7b27479 commit ddcefc8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
case <-timer.C:
// If mining is running resubmit a new work cycle periodically to pull in
// higher priced transactions. Disable this overhead for pending blocks.
if w.isRunning() && (w.chainConfig.Clique == nil || w.chainConfig.Clique.Period > 0) {
if w.isRunning() &&
(w.chainConfig.Consortium == nil || w.chainConfig.Clique == nil || w.chainConfig.Clique.Period > 0) {
// Short circuit if no new transaction arrives.
if atomic.LoadInt32(&w.newTxs) == 0 {
timer.Reset(recommit)
Expand Down

0 comments on commit ddcefc8

Please sign in to comment.