From 86c470809d443dcb2033ab4f56f5474887da7348 Mon Sep 17 00:00:00 2001 From: barryz Date: Fri, 16 Jul 2021 15:44:38 +0800 Subject: [PATCH] txpool_contentByAccount same as txpool_contentFrom --- core/tx_pool.go | 19 ------------------- eth/api_backend.go | 4 ---- internal/ethapi/backend.go | 1 - les/api_backend.go | 5 ----- 4 files changed, 29 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 017d6128dc..c5b6047486 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -494,25 +494,6 @@ func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common return pending, queued } -// ContentByAccount retrieves the data content of the transaction pool with a specific account, -// returning the pending as well as queued transaction. -func (pool *TxPool) ContentByAccount(addr common.Address) (pending, queued types.Transactions) { - pool.mu.Lock() - defer pool.mu.Unlock() - - list, ok := pool.pending[addr] - if ok { - pending = list.Flatten() - } - - list, ok = pool.queue[addr] - if ok { - queued = list.Flatten() - } - - return -} - // ContentFrom retrieves the data content of the transaction pool, returning the // pending as well as queued transactions of this address, grouped by nonce. func (pool *TxPool) ContentFrom(addr common.Address) (types.Transactions, types.Transactions) { diff --git a/eth/api_backend.go b/eth/api_backend.go index e8973b2a19..f22462c7c8 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -267,10 +267,6 @@ func (b *EthAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, return b.eth.TxPool().Content() } -func (b *EthAPIBackend) TxPoolContentByAccount(addr common.Address) (pending, queued types.Transactions) { - return b.eth.TxPool().ContentByAccount(addr) -} - func (b *EthAPIBackend) TxPoolContentFrom(addr common.Address) (types.Transactions, types.Transactions) { return b.eth.TxPool().ContentFrom(addr) } diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 3791738382..fe55ec59c8 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -77,7 +77,6 @@ type Backend interface { GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) Stats() (pending int, queued int) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) - TxPoolContentByAccount(address common.Address) (pending, queued types.Transactions) TxPoolContentFrom(addr common.Address) (types.Transactions, types.Transactions) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription diff --git a/les/api_backend.go b/les/api_backend.go index e8b10f39e2..326b540b6f 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -222,11 +222,6 @@ func (b *LesApiBackend) TxPoolContent() (map[common.Address]types.Transactions, return b.eth.txPool.Content() } -func (b *LesApiBackend) TxPoolContentByAccount(addr common.Address) (pending, queued types.Transactions) { - // TODO(barryz) not implement for light node. - return nil, nil -} - func (b *LesApiBackend) TxPoolContentFrom(addr common.Address) (types.Transactions, types.Transactions) { return b.eth.txPool.ContentFrom(addr) }