mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
core/txpool/blobpool: fix getblobs error handling (#32538)
Another getBlobs PR on top of https://github.com/ethereum/go-ethereum/pull/32190 to avoid some minor regressions. - bring back more log messages from before - continue processing also on some internal errors - ensure v2 complies with spec even if there are internal errors --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
parent
e6884ccccf
commit
70f177a527
2 changed files with 16 additions and 10 deletions
|
|
@ -1334,17 +1334,20 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte) ([]*kzg4844.Blo
|
|||
}
|
||||
data, err := p.store.Get(txID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
log.Error("Tracked blob transaction missing from store", "id", txID, "err", err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Decode the blob transaction
|
||||
tx := new(types.Transaction)
|
||||
if err := rlp.DecodeBytes(data, tx); err != nil {
|
||||
return nil, nil, nil, err
|
||||
log.Error("Blobs corrupted for traced transaction", "id", txID, "err", err)
|
||||
continue
|
||||
}
|
||||
sidecar := tx.BlobTxSidecar()
|
||||
if sidecar == nil {
|
||||
return nil, nil, nil, fmt.Errorf("blob tx without sidecar %x", tx.Hash())
|
||||
log.Error("Blob tx without sidecar", "hash", tx.Hash(), "id", txID)
|
||||
continue
|
||||
}
|
||||
// Traverse the blobs in the transaction
|
||||
for i, hash := range tx.BlobHashes() {
|
||||
|
|
|
|||
|
|
@ -541,20 +541,23 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo
|
|||
getBlobsV2RequestMiss.Inc(1)
|
||||
return nil, nil
|
||||
}
|
||||
getBlobsV2RequestHit.Inc(1)
|
||||
|
||||
blobs, _, proofs, err := api.eth.BlobTxPool().GetBlobs(hashes, types.BlobSidecarVersion1)
|
||||
if err != nil {
|
||||
return nil, engine.InvalidParams.With(err)
|
||||
}
|
||||
res := make([]*engine.BlobAndProofV2, len(hashes))
|
||||
for i := 0; i < len(blobs); i++ {
|
||||
// the blob is missing, return null as response. It should
|
||||
// be caught by `AvailableBlobs` though, perhaps data race
|
||||
// occurs between two calls.
|
||||
if blobs[i] == nil {
|
||||
|
||||
// To comply with API spec, check again that we really got all data needed
|
||||
for _, blob := range blobs {
|
||||
if blob == nil {
|
||||
getBlobsV2RequestMiss.Inc(1)
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
getBlobsV2RequestHit.Inc(1)
|
||||
|
||||
res := make([]*engine.BlobAndProofV2, len(hashes))
|
||||
for i := 0; i < len(blobs); i++ {
|
||||
var cellProofs []hexutil.Bytes
|
||||
for _, proof := range proofs[i] {
|
||||
cellProofs = append(cellProofs, proof[:])
|
||||
|
|
|
|||
Loading…
Reference in a new issue