From d05f5bc34155c6ea8053a7d561d8b02b86323051 Mon Sep 17 00:00:00 2001 From: maskpp Date: Tue, 2 Sep 2025 23:00:06 +0800 Subject: [PATCH] validate the blob tx at first to avoid unnecessary conversion --- core/txpool/blobpool/blobpool.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 64ee3fcd9a..6ff012b881 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -1406,12 +1406,14 @@ func (p *BlobPool) convertSidecar(txs []*types.Transaction) ([]*types.Transactio } var errs []error for _, tx := range txs { - sidecar := tx.BlobTxSidecar() - if sidecar == nil { - errs = append(errs, errors.New("missing sidecar in blob transaction")) + // Validate the transaction at first to avoid unnecessary conversion. + if err := p.validateTx(tx); err != nil { + errs = append(errs, err) continue } - if sidecar.Version == types.BlobSidecarVersion0 { + + sidecar := tx.BlobTxSidecar() + if tx.BlobTxSidecar().Version == types.BlobSidecarVersion0 { if err := sidecar.ToV1(); err != nil { errs = append(errs, err) continue