From 06394e068b8b6acbffb3e19f9c5dd931c07ce151 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 26 Feb 2024 15:42:37 +0800 Subject: [PATCH] core/txpool: implement blobpool.ContentFrom 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 0b183509d8..5311e1f848 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -1645,11 +1645,20 @@ func (p *BlobPool) Content() (map[common.Address][]*types.Transaction, map[commo // ContentFrom retrieves the data content of the transaction pool, returning the // pending as well as queued transactions of this address, grouped by nonce. -// -// For the blob pool, this method will return nothing for now. -// TODO(karalabe): Abstract out the returned metadata. func (p *BlobPool) ContentFrom(addr common.Address) ([]*types.Transaction, []*types.Transaction) { - return []*types.Transaction{}, []*types.Transaction{} + p.lock.Lock() + defer p.lock.Unlock() + + var pending []*types.Transaction + if metas, ok := p.index[addr]; ok { + for _, meta := range metas { + if tx, err := p.get(meta.id); err == nil { + pending = append(pending, tx) + } + } + } + var queued []*types.Transaction // No non-executable txs in the blob pool + return pending, queued } // Locals retrieves the accounts currently considered local by the pool.