mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
miner: only fill the pending block pre-merge
This commit is contained in:
parent
6c6982163b
commit
ab0d224c73
1 changed files with 30 additions and 26 deletions
|
|
@ -1068,35 +1068,39 @@ func (w *worker) commitWork(interrupt *atomic.Int32, timestamp int64) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Fill pending transactions from the txpool into the block.
|
// Don't fill the pending block post-merge
|
||||||
err = w.fillTransactions(interrupt, work)
|
if !w.chainConfig.TerminalTotalDifficultyPassed {
|
||||||
switch {
|
// Fill pending transactions from the txpool into the block.
|
||||||
case err == nil:
|
err = w.fillTransactions(interrupt, work)
|
||||||
// The entire block is filled, decrease resubmit interval in case
|
switch {
|
||||||
// of current interval is larger than the user-specified one.
|
case err == nil:
|
||||||
w.resubmitAdjustCh <- &intervalAdjust{inc: false}
|
// The entire block is filled, decrease resubmit interval in case
|
||||||
|
// of current interval is larger than the user-specified one.
|
||||||
|
w.resubmitAdjustCh <- &intervalAdjust{inc: false}
|
||||||
|
|
||||||
case errors.Is(err, errBlockInterruptedByRecommit):
|
case errors.Is(err, errBlockInterruptedByRecommit):
|
||||||
// Notify resubmit loop to increase resubmitting interval if the
|
// Notify resubmit loop to increase resubmitting interval if the
|
||||||
// interruption is due to frequent commits.
|
// interruption is due to frequent commits.
|
||||||
gaslimit := work.header.GasLimit
|
gaslimit := work.header.GasLimit
|
||||||
ratio := float64(gaslimit-work.gasPool.Gas()) / float64(gaslimit)
|
ratio := float64(gaslimit-work.gasPool.Gas()) / float64(gaslimit)
|
||||||
if ratio < 0.1 {
|
if ratio < 0.1 {
|
||||||
ratio = 0.1
|
ratio = 0.1
|
||||||
}
|
}
|
||||||
w.resubmitAdjustCh <- &intervalAdjust{
|
w.resubmitAdjustCh <- &intervalAdjust{
|
||||||
ratio: ratio,
|
ratio: ratio,
|
||||||
inc: true,
|
inc: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
case errors.Is(err, errBlockInterruptedByNewHead):
|
case errors.Is(err, errBlockInterruptedByNewHead):
|
||||||
// If the block building is interrupted by newhead event, discard it
|
// If the block building is interrupted by newhead event, discard it
|
||||||
// totally. Committing the interrupted block introduces unnecessary
|
// totally. Committing the interrupted block introduces unnecessary
|
||||||
// delay, and possibly causes miner to mine on the previous head,
|
// delay, and possibly causes miner to mine on the previous head,
|
||||||
// which could result in higher uncle rate.
|
// which could result in higher uncle rate.
|
||||||
work.discard()
|
work.discard()
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit the generated block for consensus sealing.
|
// Submit the generated block for consensus sealing.
|
||||||
w.commit(work.copy(), w.fullTaskHook, true, start)
|
w.commit(work.copy(), w.fullTaskHook, true, start)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue