core/txpool: update GetBlobs code again

This commit is contained in:
Felix Lange 2025-09-19 14:03:10 +02:00
parent 1c766f4629
commit 0a407b0fd5

View file

@ -1347,13 +1347,14 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte, convert bool) (
for i, h := range vhashes {
indices[h] = append(indices[h], i)
}
for _, vhash := range vhashes {
// Skip duplicate vhash that was already resolved in a previous iteration
if _, ok := filled[vhash]; ok {
// Skip vhash that was already resolved in a previous iteration
continue
}
// Retrieve the corresponding blob tx with the vhash, skip blob resolution
// if it's not found locally and place the null instead.
// Retrieve the corresponding blob tx with the vhash.
p.lock.RLock()
txID, exists := p.lookup.storeidOfBlob(vhash)
p.lock.RUnlock()
@ -1383,8 +1384,15 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte, convert bool) (
if !ok {
continue // non-interesting blob
}
// Mark hash as seen.
filled[hash] = struct{}{}
if sidecar.Version != version && !convert {
// Skip blobs with incompatible version. Note we still track the blob hash
// in `filled` here, ensuring that we do not resolve this tx another time.
continue
}
// Get or convert the proof.
var pf []kzg4844.Proof
if convert || sidecar.Version == version {
switch version {
case types.BlobSidecarVersion0:
if sidecar.Version == types.BlobSidecarVersion0 {
@ -1417,8 +1425,6 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte, convert bool) (
proofs[index] = pf
}
}
filled[hash] = struct{}{}
}
}
return blobs, commitments, proofs, nil
}