mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
core/txpool: update GetBlobs code again
This commit is contained in:
parent
1c766f4629
commit
0a407b0fd5
1 changed files with 39 additions and 33 deletions
|
|
@ -1347,13 +1347,14 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte, convert bool) (
|
||||||
for i, h := range vhashes {
|
for i, h := range vhashes {
|
||||||
indices[h] = append(indices[h], i)
|
indices[h] = append(indices[h], i)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, vhash := range vhashes {
|
for _, vhash := range vhashes {
|
||||||
// Skip duplicate vhash that was already resolved in a previous iteration
|
|
||||||
if _, ok := filled[vhash]; ok {
|
if _, ok := filled[vhash]; ok {
|
||||||
|
// Skip vhash that was already resolved in a previous iteration
|
||||||
continue
|
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()
|
p.lock.RLock()
|
||||||
txID, exists := p.lookup.storeidOfBlob(vhash)
|
txID, exists := p.lookup.storeidOfBlob(vhash)
|
||||||
p.lock.RUnlock()
|
p.lock.RUnlock()
|
||||||
|
|
@ -1383,8 +1384,15 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte, convert bool) (
|
||||||
if !ok {
|
if !ok {
|
||||||
continue // non-interesting blob
|
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
|
var pf []kzg4844.Proof
|
||||||
if convert || sidecar.Version == version {
|
|
||||||
switch version {
|
switch version {
|
||||||
case types.BlobSidecarVersion0:
|
case types.BlobSidecarVersion0:
|
||||||
if sidecar.Version == 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
|
proofs[index] = pf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filled[hash] = struct{}{}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return blobs, commitments, proofs, nil
|
return blobs, commitments, proofs, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue