Skip to content

Commit 2adb528

Browse files
committed
core/txpool: filter pending txs by blob sidecar version
Signed-off-by: Csaba Kiraly <[email protected]>
1 parent 440f2d3 commit 2adb528

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

core/txpool/blobpool/blobpool.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,15 @@ func (p *BlobPool) Pending(filter txpool.PendingFilter) map[common.Address][]*tx
16881688
for addr, txs := range p.index {
16891689
lazies := make([]*txpool.LazyTransaction, 0, len(txs))
16901690
for _, tx := range txs {
1691+
1692+
// Skip v0 or v1 blob transactions if not requested
1693+
if filter.OnlyBlobV0Txs && tx.version != types.BlobSidecarVersion0 {
1694+
continue
1695+
}
1696+
if filter.OnlyBlobV1Txs && tx.version != types.BlobSidecarVersion1 {
1697+
continue
1698+
}
1699+
16911700
// If transaction filtering was requested, discard badly priced ones
16921701
if filter.MinTip != nil && filter.BaseFee != nil {
16931702
if tx.execFeeCap.Lt(filter.BaseFee) {

core/txpool/legacypool/legacypool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ func (pool *LegacyPool) ContentFrom(addr common.Address) ([]*types.Transaction,
508508
func (pool *LegacyPool) Pending(filter txpool.PendingFilter) map[common.Address][]*txpool.LazyTransaction {
509509
// If only blob transactions are requested, this pool is unsuitable as it
510510
// contains none, don't even bother.
511-
if filter.OnlyBlobTxs {
511+
if filter.OnlyBlobV0Txs || filter.OnlyBlobV1Txs {
512512
return nil
513513
}
514514
pool.mu.Lock()

core/txpool/subpool.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ type PendingFilter struct {
7878
BlobFee *uint256.Int // Minimum 4844 blobfee needed to include a blob transaction
7979
GasLimitCap uint64 // Maximum gas can be used for a single transaction execution (0 means no limit)
8080

81-
OnlyPlainTxs bool // Return only plain EVM transactions (peer-join announces, block space filling)
82-
OnlyBlobTxs bool // Return only blob transactions (block blob-space filling)
81+
OnlyPlainTxs bool // Return only plain EVM transactions (peer-join announces, block space filling)
82+
OnlyBlobV0Txs bool // Return only V0 encoded blob transactions (block blob-space filling)
83+
OnlyBlobV1Txs bool // Return only V1 encoded blob transactions (block blob-space filling)
8384
}
8485

8586
// TxMetadata denotes the metadata of a transaction.

miner/worker.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,14 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment)
481481
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) {
482482
filter.GasLimitCap = params.MaxTxGas
483483
}
484-
filter.OnlyPlainTxs, filter.OnlyBlobTxs = true, false
484+
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = true, false, false
485485
pendingPlainTxs := miner.txpool.Pending(filter)
486486

487-
filter.OnlyPlainTxs, filter.OnlyBlobTxs = false, true
487+
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) {
488+
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = false, false, true
489+
} else {
490+
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = false, true, false
491+
}
488492
pendingBlobTxs := miner.txpool.Pending(filter)
489493

490494
// Split the pending transactions into locals and remotes.

0 commit comments

Comments
 (0)