Skip to content

Commit 011fe3e

Browse files
authored
core: remove unused error from TxPool.Pending (#23720)
1 parent 79b727b commit 011fe3e

File tree

8 files changed

+9
-23
lines changed

8 files changed

+9
-23
lines changed

core/tx_pool.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ func (pool *TxPool) ContentFrom(addr common.Address) (types.Transactions, types.
533533
// The enforceTips parameter can be used to do an extra filtering on the pending
534534
// transactions and only return those whose **effective** tip is large enough in
535535
// the next pending execution environment.
536-
func (pool *TxPool) Pending(enforceTips bool) (map[common.Address]types.Transactions, error) {
536+
func (pool *TxPool) Pending(enforceTips bool) map[common.Address]types.Transactions {
537537
pool.mu.Lock()
538538
defer pool.mu.Unlock()
539539

@@ -554,7 +554,7 @@ func (pool *TxPool) Pending(enforceTips bool) (map[common.Address]types.Transact
554554
pending[addr] = txs
555555
}
556556
}
557-
return pending, nil
557+
return pending
558558
}
559559

560560
// Locals retrieves the accounts currently considered local by the pool.

core/tx_pool_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ func TestStateChangeDuringTransactionPoolReset(t *testing.T) {
255255
trigger = true
256256
<-pool.requestReset(nil, nil)
257257

258-
_, err := pool.Pending(false)
259-
if err != nil {
260-
t.Fatalf("Could not fetch pending transactions: %v", err)
261-
}
262258
nonce = pool.Nonce(address)
263259
if nonce != 2 {
264260
t.Fatalf("Invalid nonce, want 2, got %d", nonce)

eth/api_backend.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,7 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction)
240240
}
241241

242242
func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error) {
243-
pending, err := b.eth.txPool.Pending(false)
244-
if err != nil {
245-
return nil, err
246-
}
243+
pending := b.eth.txPool.Pending(false)
247244
var txs types.Transactions
248245
for _, batch := range pending {
249246
txs = append(txs, batch...)

eth/catalyst/api.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ func (api *consensusAPI) AssembleBlock(params assembleBlockParams) (*executableD
126126
time.Sleep(wait)
127127
}
128128

129-
pending, err := pool.Pending(true)
130-
if err != nil {
131-
return nil, err
132-
}
129+
pending := pool.Pending(true)
133130

134131
coinbase, err := api.eth.Etherbase()
135132
if err != nil {

eth/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type txPool interface {
6666

6767
// Pending should return pending transactions.
6868
// The slice should be modifiable by the caller.
69-
Pending(enforceTips bool) (map[common.Address]types.Transactions, error)
69+
Pending(enforceTips bool) map[common.Address]types.Transactions
7070

7171
// SubscribeNewTxsEvent should return an event subscription of
7272
// NewTxsEvent and send events to the given channel.

eth/handler_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (p *testTxPool) AddRemotes(txs []*types.Transaction) []error {
9191
}
9292

9393
// Pending returns all the transactions known to the pool
94-
func (p *testTxPool) Pending(enforceTips bool) (map[common.Address]types.Transactions, error) {
94+
func (p *testTxPool) Pending(enforceTips bool) map[common.Address]types.Transactions {
9595
p.lock.RLock()
9696
defer p.lock.RUnlock()
9797

@@ -103,7 +103,7 @@ func (p *testTxPool) Pending(enforceTips bool) (map[common.Address]types.Transac
103103
for _, batch := range batches {
104104
sort.Sort(types.TxByNonce(batch))
105105
}
106-
return batches, nil
106+
return batches
107107
}
108108

109109
// SubscribeNewTxsEvent should return an event subscription of NewTxsEvent and

eth/sync.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (h *handler) syncTransactions(p *eth.Peer) {
4343
//
4444
// TODO(karalabe): Figure out if we could get away with random order somehow
4545
var txs types.Transactions
46-
pending, _ := h.txpool.Pending(false)
46+
pending := h.txpool.Pending(false)
4747
for _, batch := range pending {
4848
txs = append(txs, batch...)
4949
}

miner/worker.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -987,11 +987,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
987987
}
988988

989989
// Fill the block with all available pending transactions.
990-
pending, err := w.eth.TxPool().Pending(true)
991-
if err != nil {
992-
log.Error("Failed to fetch pending transactions", "err", err)
993-
return
994-
}
990+
pending := w.eth.TxPool().Pending(true)
995991
// Short circuit if there is no available pending transactions.
996992
// But if we disable empty precommit already, ignore it. Since
997993
// empty block is necessary to keep the liveness of the network.

0 commit comments

Comments
 (0)