@@ -436,8 +436,10 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserve txpool.Addres
436436// Close closes down the underlying persistent store.
437437func (p * BlobPool ) Close () error {
438438 var errs []error
439- if err := p .limbo .Close (); err != nil {
440- errs = append (errs , err )
439+ if p .limbo != nil { // Close might be invoked due to error in constructor, before p,limbo is set
440+ if err := p .limbo .Close (); err != nil {
441+ errs = append (errs , err )
442+ }
441443 }
442444 if err := p .store .Close (); err != nil {
443445 errs = append (errs , err )
@@ -1441,7 +1443,10 @@ func (p *BlobPool) drop() {
14411443
14421444// Pending retrieves all currently processable transactions, grouped by origin
14431445// account and sorted by nonce.
1444- func (p * BlobPool ) Pending (enforceTips bool ) map [common.Address ][]* txpool.LazyTransaction {
1446+ //
1447+ // The transactions can also be pre-filtered by the dynamic fee components to
1448+ // reduce allocations and load on downstream subsystems.
1449+ func (p * BlobPool ) Pending (minTip * uint256.Int , baseFee * uint256.Int , blobFee * uint256.Int ) map [common.Address ][]* txpool.LazyTransaction {
14451450 // Track the amount of time waiting to retrieve the list of pending blob txs
14461451 // from the pool and the amount of time actually spent on assembling the data.
14471452 // The latter will be pretty much moot, but we've kept it to have symmetric
@@ -1459,6 +1464,25 @@ func (p *BlobPool) Pending(enforceTips bool) map[common.Address][]*txpool.LazyTr
14591464 for addr , txs := range p .index {
14601465 var lazies []* txpool.LazyTransaction
14611466 for _ , tx := range txs {
1467+ // If transaction filtering was requested, discard badly priced ones
1468+ if minTip != nil && baseFee != nil {
1469+ if tx .execFeeCap .Lt (baseFee ) {
1470+ break // basefee too low, cannot be included, discard rest of txs from the account
1471+ }
1472+ tip := new (uint256.Int ).Sub (tx .execFeeCap , baseFee )
1473+ if tip .Gt (tx .execTipCap ) {
1474+ tip = tx .execTipCap
1475+ }
1476+ if tip .Lt (minTip ) {
1477+ break // allowed or remaining tip too low, cannot be included, discard rest of txs from the account
1478+ }
1479+ }
1480+ if blobFee != nil {
1481+ if tx .blobFeeCap .Lt (blobFee ) {
1482+ break // blobfee too low, cannot be included, discard rest of txs from the account
1483+ }
1484+ }
1485+ // Transaction was accepted according to the filter, append to the pending list
14621486 lazies = append (lazies , & txpool.LazyTransaction {
14631487 Pool : p ,
14641488 Hash : tx .hash ,
0 commit comments