Skip to content

Commit

Permalink
enable pending block (ethereum#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Qi Zhou <qzhou64@gmail.com>
  • Loading branch information
qizhou and Qi Zhou committed Mar 12, 2022
1 parent 309bd8b commit 2ce03ad
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
defer timer.Stop()
<-timer.C // discard the initial tick

_, isTm := w.engine.(*tendermint.Tendermint)
// commit aborts in-flight transaction execution with given signal and resubmits a new one.
commit := func(noempty bool, s int32) {
if interrupt != nil {
Expand Down Expand Up @@ -464,26 +463,16 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
case <-w.startCh:
clearPending(w.chain.CurrentBlock().NumberU64())

if isTm {
continue
}

timestamp = time.Now().Unix()
commit(false, commitInterruptNewHead)

case head := <-w.chainHeadCh:

clearPending(head.Block.NumberU64())
if isTm {
continue
}

timestamp = time.Now().Unix()
commit(false, commitInterruptNewHead)

case <-timer.C:
if isTm {
continue
}
// If sealing 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) {
Expand All @@ -496,9 +485,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
}

case interval := <-w.resubmitIntervalCh:
if isTm {
continue
}
// Adjust resubmit interval explicitly by user.
if interval < minRecommitInterval {
log.Warn("Sanitizing miner recommit interval", "provided", interval, "updated", minRecommitInterval)
Expand All @@ -512,9 +498,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) {
}

case adjust := <-w.resubmitAdjustCh:
if isTm {
continue
}
// Adjust resubmit interval by feedback.
if adjust.inc {
before := recommit
Expand Down Expand Up @@ -1161,7 +1144,8 @@ func (w *worker) commitWork(interrupt *int32, noempty bool, timestamp int64) {
// Note the assumption is held that the mutation is allowed to the passed env, do
// the deep copy first.
func (w *worker) commit(env *environment, interval func(), update bool, start time.Time) error {
if w.isRunning() {
_, isTm := w.engine.(*tendermint.Tendermint)
if w.isRunning() && !isTm {
if interval != nil {
interval()
}
Expand Down

0 comments on commit 2ce03ad

Please sign in to comment.