eth/catalyst: refactor

This commit is contained in:
Bosul Mun 2026-05-11 22:06:59 +02:00 committed by GitHub
parent 94ba237031
commit af6da4b13a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -629,6 +629,7 @@ func (api *ConsensusAPI) getBlobs(hashes []common.Hash, v2 bool) ([]*engine.Blob
return nil, engine.InvalidParams.With(err)
}
// Validate the blobs from the pool and assemble the response
filled := 0
res := make([]*engine.BlobAndProofV2, len(hashes))
for i := range blobs {
// The blob has been evicted since the last AvailableBlobs call.
@ -649,17 +650,11 @@ func (api *ConsensusAPI) getBlobs(hashes []common.Hash, v2 bool) ([]*engine.Blob
Blob: blobs[i][:],
CellProofs: cellProofs,
}
filled++
}
nonNilCount := 0
for _, r := range res {
if r != nil {
nonNilCount++
}
}
if nonNilCount == len(hashes) {
if filled == len(hashes) {
getBlobsRequestCompleteHit.Inc(1)
} else if nonNilCount > 0 {
} else if filled > 0 {
getBlobsRequestPartialHit.Inc(1)
} else {
getBlobsRequestMiss.Inc(1)