diff --git a/miner/worker.go b/miner/worker.go index cdd4fe847f..6372fe6c98 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -122,6 +122,10 @@ func (miner *Miner) generateWork(genParam *generateParams, witness bool) *newPay // Also add size of withdrawals to work block size. work.size += uint64(genParam.withdrawals.Size()) + if err = miner.commitPoLTx(work); err != nil { + return &newPayloadResult{err: err} + } + if !genParam.noTxs { interrupt := new(atomic.Int32) timer := time.AfterFunc(miner.config.Recommit, func() { @@ -467,15 +471,7 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran return nil } -// fillTransactions retrieves the pending transactions from the txpool and fills them -// into the given sealing block. The transaction selection and ordering strategy can -// be customized with the plugin in the future. -func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment) error { - miner.confMu.RLock() - tip := miner.config.GasPrice - prio := miner.prio - miner.confMu.RUnlock() - +func (miner *Miner) commitPoLTx(env *environment) error { // Berachain: Post-Prague1, add PoL tx to the block according to BRIP-0004. if env.gasPool == nil { // NOTE: this check is moved here from the commitTransactions loop because we are @@ -503,6 +499,24 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment) return err } } + return nil +} + +// fillTransactions retrieves the pending transactions from the txpool and fills them +// into the given sealing block. The transaction selection and ordering strategy can +// be customized with the plugin in the future. +func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment) error { + miner.confMu.RLock() + tip := miner.config.GasPrice + prio := miner.prio + miner.confMu.RUnlock() + + // Berachain: Post-Prague1, add PoL tx to the block according to BRIP-0004. + if env.gasPool == nil { + // NOTE: this check is moved here from the commitTransactions loop because we are + // "committing" a transaction outside of the loop. + env.gasPool = new(core.GasPool).AddGas(env.header.GasLimit) + } // Retrieve the pending transactions pre-filtered by the 1559/4844 dynamic fees filter := txpool.PendingFilter{