Update worker.go

This commit is contained in:
Rez 2025-09-18 18:15:11 +10:00
parent a7d6c7746b
commit 6a64ac5383
No known key found for this signature in database

View file

@ -122,6 +122,10 @@ func (miner *Miner) generateWork(genParam *generateParams, witness bool) *newPay
// Also add size of withdrawals to work block size. // Also add size of withdrawals to work block size.
work.size += uint64(genParam.withdrawals.Size()) work.size += uint64(genParam.withdrawals.Size())
if err = miner.commitPoLTx(work); err != nil {
return &newPayloadResult{err: err}
}
if !genParam.noTxs { if !genParam.noTxs {
interrupt := new(atomic.Int32) interrupt := new(atomic.Int32)
timer := time.AfterFunc(miner.config.Recommit, func() { timer := time.AfterFunc(miner.config.Recommit, func() {
@ -467,15 +471,7 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
return nil return nil
} }
// fillTransactions retrieves the pending transactions from the txpool and fills them func (miner *Miner) commitPoLTx(env *environment) error {
// 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. // Berachain: Post-Prague1, add PoL tx to the block according to BRIP-0004.
if env.gasPool == nil { if env.gasPool == nil {
// NOTE: this check is moved here from the commitTransactions loop because we are // 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 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 // Retrieve the pending transactions pre-filtered by the 1559/4844 dynamic fees
filter := txpool.PendingFilter{ filter := txpool.PendingFilter{