From f22a2d64e87b126ec77e70b70e87e1b61e44b04f Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 26 Feb 2024 15:33:19 +0800 Subject: [PATCH] core/blobpool: implment blobpool Content Signed-off-by: jsvisa --- core/txpool/blobpool/blobpool.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index a150a61629..0b183509d8 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -1627,11 +1627,20 @@ func (p *BlobPool) Stats() (int, int) { // Content retrieves the data content of the transaction pool, returning all the // pending as well as queued transactions, grouped by account and sorted by nonce. -// -// For the blob pool, this method will return nothing for now. -// TODO(karalabe): Abstract out the returned metadata. func (p *BlobPool) Content() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) { - return make(map[common.Address][]*types.Transaction), make(map[common.Address][]*types.Transaction) + p.lock.Lock() + defer p.lock.Unlock() + + pending := make(map[common.Address][]*types.Transaction, len(p.index)) + for addr, metas := range p.index { + for _, meta := range metas { + if tx, err := p.get(meta.id); err == nil { + pending[addr] = append(pending[addr], tx) + } + } + } + queued := make(map[common.Address][]*types.Transaction) // No non-executable txs in the blob pool + return pending, queued } // ContentFrom retrieves the data content of the transaction pool, returning the