Skip to content

Commit

Permalink
fix empty block issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chenquanyu committed May 27, 2022
1 parent c972ede commit 7d98b4e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,19 +990,14 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
commitUncles(w.localUncles)
commitUncles(w.remoteUncles)

// Create an empty block based on temporary copied state for
// sealing in advance without waiting block execution finished.
if !noempty && atomic.LoadUint32(&w.noempty) == 0 {
w.commit(uncles, nil, false, tstart)
}

// Fill the block with all available pending transactions.
pending, _ := w.eth.TxPool().Pending()

// Short circuit if there is no available pending transactions.
// But if we disable empty precommit already, ignore it. Since
// empty block is necessary to keep the liveness of the network.
if len(pending) == 0 && atomic.LoadUint32(&w.noempty) == 0 {
if !noempty && len(pending) == 0 && atomic.LoadUint32(&w.noempty) == 0 {
w.commit(uncles, nil, false, tstart)
w.updateSnapshot()
return
}
Expand Down

0 comments on commit 7d98b4e

Please sign in to comment.