Remove HasBlobs and use GetBlobCounts

This commit is contained in:
Minhyuk Kim 2025-04-13 20:51:45 +09:00 committed by SunnysidedJ
parent 81daff43ac
commit 7ad169f672
No known key found for this signature in database
GPG key ID: 4A3483B2B3B72950
4 changed files with 0 additions and 37 deletions

View file

@ -1325,19 +1325,6 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar {
return sidecars return sidecars
} }
func (p *BlobPool) HasBlobs(vhashes []common.Hash) bool {
for _, vhash := range vhashes {
// Retrieve the datastore item (in a short lock)
p.lock.RLock()
_, exists := p.lookup.storeidOfBlob(vhash)
p.lock.RUnlock()
if !exists {
return false
}
}
return true
}
func (p *BlobPool) GetBlobCounts(vhashes []common.Hash) int { func (p *BlobPool) GetBlobCounts(vhashes []common.Hash) int {
count := 0 count := 0
for _, vhash := range vhashes { for _, vhash := range vhashes {

View file

@ -1068,12 +1068,6 @@ func (pool *LegacyPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar {
return nil return nil
} }
// HasBlobs is not supported by the legacy transaction pool, it is just here to
// implement the txpool.SubPool interface.
func (pool *LegacyPool) HasBlobs(vhashes []common.Hash) bool {
return false
}
// GetBlobCounts returns number of blobs in the subpool that matches the given // GetBlobCounts returns number of blobs in the subpool that matches the given
// versioned hashes, without performing db read. // versioned hashes, without performing db read.
func (pool *LegacyPool) GetBlobCounts(vhashes []common.Hash) int { func (pool *LegacyPool) GetBlobCounts(vhashes []common.Hash) int {

View file

@ -137,10 +137,6 @@ type SubPool interface {
// retrieve blobs from the pools directly instead of the network. // retrieve blobs from the pools directly instead of the network.
GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar
// HasBlobs returns true if all blobs corresponding to the versioned hashes
// are in the sub pool.
HasBlobs(vhashes []common.Hash) bool
// GetBlobCounts returns number of blobs in the subpool that matches the given // GetBlobCounts returns number of blobs in the subpool that matches the given
// versioned hashes, without performing db read. // versioned hashes, without performing db read.
GetBlobCounts(vhashes []common.Hash) int GetBlobCounts(vhashes []common.Hash) int

View file

@ -334,20 +334,6 @@ func (p *TxPool) GetBlobCounts(vhashes []common.Hash) int {
return 0 return 0
} }
// HasBlobs will return true if all the vhashes are available in the same subpool.
func (p *TxPool) HasBlobs(vhashes []common.Hash) bool {
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 subpool.HasBlobs(vhashes) {
return true
}
}
return false
}
// ValidateTxBasics checks whether a transaction is valid according to the consensus // ValidateTxBasics checks whether a transaction is valid according to the consensus
// rules, but does not check state-dependent validation such as sufficient balance. // rules, but does not check state-dependent validation such as sufficient balance.
func (p *TxPool) ValidateTxBasics(tx *types.Transaction) error { func (p *TxPool) ValidateTxBasics(tx *types.Transaction) error {