core/txpool: filter pending txs by blob sidecar version

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2025-09-10 20:47:18 +02:00
parent 440f2d34de
commit 2adb528704
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E
4 changed files with 19 additions and 5 deletions

View file

@ -1688,6 +1688,15 @@ func (p *BlobPool) Pending(filter txpool.PendingFilter) map[common.Address][]*tx
for addr, txs := range p.index {
lazies := make([]*txpool.LazyTransaction, 0, len(txs))
for _, tx := range txs {
// Skip v0 or v1 blob transactions if not requested
if filter.OnlyBlobV0Txs && tx.version != types.BlobSidecarVersion0 {
continue
}
if filter.OnlyBlobV1Txs && tx.version != types.BlobSidecarVersion1 {
continue
}
// If transaction filtering was requested, discard badly priced ones
if filter.MinTip != nil && filter.BaseFee != nil {
if tx.execFeeCap.Lt(filter.BaseFee) {

View file

@ -508,7 +508,7 @@ func (pool *LegacyPool) ContentFrom(addr common.Address) ([]*types.Transaction,
func (pool *LegacyPool) Pending(filter txpool.PendingFilter) map[common.Address][]*txpool.LazyTransaction {
// If only blob transactions are requested, this pool is unsuitable as it
// contains none, don't even bother.
if filter.OnlyBlobTxs {
if filter.OnlyBlobV0Txs || filter.OnlyBlobV1Txs {
return nil
}
pool.mu.Lock()

View file

@ -78,8 +78,9 @@ type PendingFilter struct {
BlobFee *uint256.Int // Minimum 4844 blobfee needed to include a blob transaction
GasLimitCap uint64 // Maximum gas can be used for a single transaction execution (0 means no limit)
OnlyPlainTxs bool // Return only plain EVM transactions (peer-join announces, block space filling)
OnlyBlobTxs bool // Return only blob transactions (block blob-space filling)
OnlyPlainTxs bool // Return only plain EVM transactions (peer-join announces, block space filling)
OnlyBlobV0Txs bool // Return only V0 encoded blob transactions (block blob-space filling)
OnlyBlobV1Txs bool // Return only V1 encoded blob transactions (block blob-space filling)
}
// TxMetadata denotes the metadata of a transaction.

View file

@ -481,10 +481,14 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment)
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) {
filter.GasLimitCap = params.MaxTxGas
}
filter.OnlyPlainTxs, filter.OnlyBlobTxs = true, false
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = true, false, false
pendingPlainTxs := miner.txpool.Pending(filter)
filter.OnlyPlainTxs, filter.OnlyBlobTxs = false, true
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) {
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = false, false, true
} else {
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = false, true, false
}
pendingBlobTxs := miner.txpool.Pending(filter)
// Split the pending transactions into locals and remotes.