diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index fdf3922cc1..1de7147426 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1062,18 +1062,6 @@ func (pool *LegacyPool) GetMetadata(hash common.Hash) *txpool.TxMetadata { } } -// GetBlobs is not supported by the legacy transaction pool, it is just here to -// implement the txpool.SubPool interface. -func (pool *LegacyPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar { - return nil -} - -// AvailableBlobs is not supported by the legacy transaction pool, it is just here to -// implement the txpool.SubPool interface. -func (pool *LegacyPool) AvailableBlobs(vhashes []common.Hash) int { - return 0 -} - // Has returns an indicator whether txpool has a transaction cached with the // given hash. func (pool *LegacyPool) Has(hash common.Hash) bool { diff --git a/core/txpool/subpool.go b/core/txpool/subpool.go index 5e18ce99fb..ed4a42940d 100644 --- a/core/txpool/subpool.go +++ b/core/txpool/subpool.go @@ -132,15 +132,6 @@ type SubPool interface { // given transaction hash. GetMetadata(hash common.Hash) *TxMetadata - // GetBlobs returns a number of blobs are proofs for the given versioned hashes. - // This is a utility method for the engine API, enabling consensus clients to - // retrieve blobs from the pools directly instead of the network. - GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar - - // AvailableBlobs returns number of blobs corresponding to the versioned hashes - // that are available in the sub pool. - AvailableBlobs(vhashes []common.Hash) int - // ValidateTxBasics checks whether a transaction is valid according to the consensus // rules, but does not check state-dependent validation such as sufficient balance. // This check is meant as a static check which can be performed without holding the diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index b4643ae1df..b5470cd7fc 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -307,36 +307,6 @@ func (p *TxPool) GetMetadata(hash common.Hash) *TxMetadata { return nil } -// GetBlobs returns a number of blobs are proofs for the given versioned hashes. -// This is a utility method for the engine API, enabling consensus clients to -// retrieve blobs from the pools directly instead of the network. -func (p *TxPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar { - for _, subpool := range p.subpools { - // It's an ugly to assume that only one pool will be capable of returning - // anything meaningful for this call, but anything else requires merging - // partial responses and that's too annoying to do until we get a second - // blobpool (probably never). - if sidecars := subpool.GetBlobs(vhashes); sidecars != nil { - return sidecars - } - } - return nil -} - -// AvailableBlobs will return the number of vhashes that are available in the same subpool. -func (p *TxPool) AvailableBlobs(vhashes []common.Hash) int { - for _, subpool := range p.subpools { - // It's an ugly to assume that only one pool will be capable of returning - // anything meaningful for this call, but anything else requires merging - // partial responses and that's too annoying to do until we get a second - // blobpool (probably never). - if count := subpool.AvailableBlobs(vhashes); count != 0 { - return count - } - } - return 0 -} - // Add enqueues a batch of transactions into the pool if they are valid. Due // to the large transaction churn, add may postpone fully integrating the tx // to a later point to batch multiple ones together. diff --git a/eth/backend.go b/eth/backend.go index 7f9e45edea..9288033eb4 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -92,6 +92,7 @@ type Ethereum struct { // core protocol objects config *ethconfig.Config txPool *txpool.TxPool + blobTxPool *blobpool.BlobPool localTxTracker *locals.TxTracker blockchain *core.BlockChain @@ -395,6 +396,7 @@ func (s *Ethereum) Miner() *miner.Miner { return s.miner } func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager } func (s *Ethereum) BlockChain() *core.BlockChain { return s.blockchain } func (s *Ethereum) TxPool() *txpool.TxPool { return s.txPool } +func (s *Ethereum) BlobTxPool() *blobpool.BlobPool { return s.blobTxPool } func (s *Ethereum) Engine() consensus.Engine { return s.engine } func (s *Ethereum) ChainDb() ethdb.Database { return s.chainDb } func (s *Ethereum) IsListening() bool { return true } // Always listening diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 70614949a3..cbbdbbb361 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -492,7 +492,7 @@ func (api *ConsensusAPI) GetBlobsV1(hashes []common.Hash) ([]*engine.BlobAndProo res = make([]*engine.BlobAndProofV1, len(hashes)) hasher = sha256.New() index = make(map[common.Hash]int) - sidecars = api.eth.TxPool().GetBlobs(hashes) + sidecars = api.eth.BlobTxPool().GetBlobs(hashes) ) for i, hash := range hashes { @@ -522,7 +522,7 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo return nil, engine.TooLargeRequest.With(fmt.Errorf("requested blob count too large: %v", len(hashes))) } - available := api.eth.TxPool().AvailableBlobs(hashes) + available := api.eth.BlobTxPool().AvailableBlobs(hashes) getBlobsRequestedCounter.Inc(int64(len(hashes))) getBlobsAvailableCounter.Inc(int64(available)) // Optimization: check first if all blobs are available, if not, return empty response @@ -536,7 +536,7 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo var ( res = make([]*engine.BlobAndProofV2, len(hashes)) index = make(map[common.Hash][]int) - sidecars = api.eth.TxPool().GetBlobs(hashes) + sidecars = api.eth.BlobTxPool().GetBlobs(hashes) ) for i, hash := range hashes {