Skip to content

Commit 60aacd2

Browse files
committed
core/txpool, eth/catalyst: call blob methods on blobpool
1 parent 73687b9 commit 60aacd2

File tree

5 files changed

+5
-54
lines changed

5 files changed

+5
-54
lines changed

core/txpool/legacypool/legacypool.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,18 +1062,6 @@ func (pool *LegacyPool) GetMetadata(hash common.Hash) *txpool.TxMetadata {
10621062
}
10631063
}
10641064

1065-
// GetBlobs is not supported by the legacy transaction pool, it is just here to
1066-
// implement the txpool.SubPool interface.
1067-
func (pool *LegacyPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar {
1068-
return nil
1069-
}
1070-
1071-
// AvailableBlobs is not supported by the legacy transaction pool, it is just here to
1072-
// implement the txpool.SubPool interface.
1073-
func (pool *LegacyPool) AvailableBlobs(vhashes []common.Hash) int {
1074-
return 0
1075-
}
1076-
10771065
// Has returns an indicator whether txpool has a transaction cached with the
10781066
// given hash.
10791067
func (pool *LegacyPool) Has(hash common.Hash) bool {

core/txpool/subpool.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,6 @@ type SubPool interface {
132132
// given transaction hash.
133133
GetMetadata(hash common.Hash) *TxMetadata
134134

135-
// GetBlobs returns a number of blobs are proofs for the given versioned hashes.
136-
// This is a utility method for the engine API, enabling consensus clients to
137-
// retrieve blobs from the pools directly instead of the network.
138-
GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar
139-
140-
// AvailableBlobs returns number of blobs corresponding to the versioned hashes
141-
// that are available in the sub pool.
142-
AvailableBlobs(vhashes []common.Hash) int
143-
144135
// ValidateTxBasics checks whether a transaction is valid according to the consensus
145136
// rules, but does not check state-dependent validation such as sufficient balance.
146137
// This check is meant as a static check which can be performed without holding the

core/txpool/txpool.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -307,36 +307,6 @@ func (p *TxPool) GetMetadata(hash common.Hash) *TxMetadata {
307307
return nil
308308
}
309309

310-
// GetBlobs returns a number of blobs are proofs for the given versioned hashes.
311-
// This is a utility method for the engine API, enabling consensus clients to
312-
// retrieve blobs from the pools directly instead of the network.
313-
func (p *TxPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar {
314-
for _, subpool := range p.subpools {
315-
// It's an ugly to assume that only one pool will be capable of returning
316-
// anything meaningful for this call, but anything else requires merging
317-
// partial responses and that's too annoying to do until we get a second
318-
// blobpool (probably never).
319-
if sidecars := subpool.GetBlobs(vhashes); sidecars != nil {
320-
return sidecars
321-
}
322-
}
323-
return nil
324-
}
325-
326-
// AvailableBlobs will return the number of vhashes that are available in the same subpool.
327-
func (p *TxPool) AvailableBlobs(vhashes []common.Hash) int {
328-
for _, subpool := range p.subpools {
329-
// It's an ugly to assume that only one pool will be capable of returning
330-
// anything meaningful for this call, but anything else requires merging
331-
// partial responses and that's too annoying to do until we get a second
332-
// blobpool (probably never).
333-
if count := subpool.AvailableBlobs(vhashes); count != 0 {
334-
return count
335-
}
336-
}
337-
return 0
338-
}
339-
340310
// Add enqueues a batch of transactions into the pool if they are valid. Due
341311
// to the large transaction churn, add may postpone fully integrating the tx
342312
// to a later point to batch multiple ones together.

eth/backend.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type Ethereum struct {
9292
// core protocol objects
9393
config *ethconfig.Config
9494
txPool *txpool.TxPool
95+
blobTxPool *blobpool.BlobPool
9596
localTxTracker *locals.TxTracker
9697
blockchain *core.BlockChain
9798

@@ -395,6 +396,7 @@ func (s *Ethereum) Miner() *miner.Miner { return s.miner }
395396
func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager }
396397
func (s *Ethereum) BlockChain() *core.BlockChain { return s.blockchain }
397398
func (s *Ethereum) TxPool() *txpool.TxPool { return s.txPool }
399+
func (s *Ethereum) BlobTxPool() *blobpool.BlobPool { return s.blobTxPool }
398400
func (s *Ethereum) Engine() consensus.Engine { return s.engine }
399401
func (s *Ethereum) ChainDb() ethdb.Database { return s.chainDb }
400402
func (s *Ethereum) IsListening() bool { return true } // Always listening

eth/catalyst/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ func (api *ConsensusAPI) GetBlobsV1(hashes []common.Hash) ([]*engine.BlobAndProo
492492
res = make([]*engine.BlobAndProofV1, len(hashes))
493493
hasher = sha256.New()
494494
index = make(map[common.Hash]int)
495-
sidecars = api.eth.TxPool().GetBlobs(hashes)
495+
sidecars = api.eth.BlobTxPool().GetBlobs(hashes)
496496
)
497497

498498
for i, hash := range hashes {
@@ -522,7 +522,7 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo
522522
return nil, engine.TooLargeRequest.With(fmt.Errorf("requested blob count too large: %v", len(hashes)))
523523
}
524524

525-
available := api.eth.TxPool().AvailableBlobs(hashes)
525+
available := api.eth.BlobTxPool().AvailableBlobs(hashes)
526526
getBlobsRequestedCounter.Inc(int64(len(hashes)))
527527
getBlobsAvailableCounter.Inc(int64(available))
528528
// 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
536536
var (
537537
res = make([]*engine.BlobAndProofV2, len(hashes))
538538
index = make(map[common.Hash][]int)
539-
sidecars = api.eth.TxPool().GetBlobs(hashes)
539+
sidecars = api.eth.BlobTxPool().GetBlobs(hashes)
540540
)
541541

542542
for i, hash := range hashes {

0 commit comments

Comments
 (0)