From c41d0fdcf6a84af959efc05dd8e04f7f87878c17 Mon Sep 17 00:00:00 2001 From: maskpp Date: Fri, 11 Jul 2025 13:55:01 +0800 Subject: [PATCH] if multi blobs in the same tx, fill the other sidecars --- core/txpool/blobpool/blobpool.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 078af34864..da729f6aac 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -21,6 +21,7 @@ import ( "container/heap" "errors" "fmt" + "golang.org/x/exp/slices" "math" "math/big" "os" @@ -1302,6 +1303,9 @@ func (p *BlobPool) GetMetadata(hash common.Hash) *txpool.TxMetadata { func (p *BlobPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar { sidecars := make([]*types.BlobTxSidecar, len(vhashes)) for idx, vhash := range vhashes { + if sidecars[idx] != nil { + continue + } // Retrieve the datastore item (in a short lock) p.lock.RLock() id, exists := p.lookup.storeidOfBlob(vhash) @@ -1323,6 +1327,17 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash) []*types.BlobTxSidecar { continue } sidecars[idx] = item.BlobTxSidecar() + + // If multi blobs in one transaction, fill the other sidecars. + hashes := item.BlobHashes() + for i, vHash := range hashes { + if sidecars[idx] != nil { + continue + } + if index := slices.Index(hashes, vHash); index != -1 { + sidecars[i] = item.BlobTxSidecar() + } + } } return sidecars }