mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-02 13:08:41 +00:00
eth/catalyst: refactor
This commit is contained in:
parent
94ba237031
commit
af6da4b13a
1 changed files with 4 additions and 9 deletions
|
|
@ -629,6 +629,7 @@ func (api *ConsensusAPI) getBlobs(hashes []common.Hash, v2 bool) ([]*engine.Blob
|
||||||
return nil, engine.InvalidParams.With(err)
|
return nil, engine.InvalidParams.With(err)
|
||||||
}
|
}
|
||||||
// Validate the blobs from the pool and assemble the response
|
// Validate the blobs from the pool and assemble the response
|
||||||
|
filled := 0
|
||||||
res := make([]*engine.BlobAndProofV2, len(hashes))
|
res := make([]*engine.BlobAndProofV2, len(hashes))
|
||||||
for i := range blobs {
|
for i := range blobs {
|
||||||
// The blob has been evicted since the last AvailableBlobs call.
|
// 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][:],
|
Blob: blobs[i][:],
|
||||||
CellProofs: cellProofs,
|
CellProofs: cellProofs,
|
||||||
}
|
}
|
||||||
|
filled++
|
||||||
}
|
}
|
||||||
|
if filled == len(hashes) {
|
||||||
nonNilCount := 0
|
|
||||||
for _, r := range res {
|
|
||||||
if r != nil {
|
|
||||||
nonNilCount++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if nonNilCount == len(hashes) {
|
|
||||||
getBlobsRequestCompleteHit.Inc(1)
|
getBlobsRequestCompleteHit.Inc(1)
|
||||||
} else if nonNilCount > 0 {
|
} else if filled > 0 {
|
||||||
getBlobsRequestPartialHit.Inc(1)
|
getBlobsRequestPartialHit.Inc(1)
|
||||||
} else {
|
} else {
|
||||||
getBlobsRequestMiss.Inc(1)
|
getBlobsRequestMiss.Inc(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue