mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
core: remove unused error from TxPool.Pending (#23720)
This commit is contained in:
parent
27071a4219
commit
e5fb0b4d73
7 changed files with 8 additions and 19 deletions
|
|
@ -569,7 +569,7 @@ func (pool *TxPool) ContentFrom(addr common.Address) (types.Transactions, types.
|
|||
// The enforceTips parameter can be used to do an extra filtering on the pending
|
||||
// transactions and only return those whose **effective** tip is large enough in
|
||||
// the next pending execution environment.
|
||||
func (pool *TxPool) Pending(enforceTips bool) (map[common.Address]types.Transactions, error) {
|
||||
func (pool *TxPool) Pending(enforceTips bool) map[common.Address]types.Transactions {
|
||||
pool.mu.Lock()
|
||||
defer pool.mu.Unlock()
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ func (pool *TxPool) Pending(enforceTips bool) (map[common.Address]types.Transact
|
|||
pending[addr] = txs
|
||||
}
|
||||
}
|
||||
return pending, nil
|
||||
return pending
|
||||
}
|
||||
|
||||
// Locals retrieves the accounts currently considered local by the pool.
|
||||
|
|
|
|||
|
|
@ -272,10 +272,6 @@ func TestStateChangeDuringTransactionPoolReset(t *testing.T) {
|
|||
trigger = true
|
||||
<-pool.requestReset(nil, nil)
|
||||
|
||||
_, err := pool.Pending(false)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not fetch pending transactions: %v", err)
|
||||
}
|
||||
nonce = pool.Nonce(address)
|
||||
if nonce != 2 {
|
||||
t.Fatalf("Invalid nonce, want 2, got %d", nonce)
|
||||
|
|
|
|||
|
|
@ -298,10 +298,7 @@ func (b *EthApiBackend) SendLendingTx(ctx context.Context, signedTx *types.Lendi
|
|||
}
|
||||
|
||||
func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) {
|
||||
pending, err := b.eth.txPool.Pending(false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pending := b.eth.txPool.Pending(false)
|
||||
var txs types.Transactions
|
||||
for _, batch := range pending {
|
||||
txs = append(txs, batch...)
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ func (p *testTxPool) AddRemotes(txs []*types.Transaction) []error {
|
|||
}
|
||||
|
||||
// Pending returns all the transactions known to the pool
|
||||
func (p *testTxPool) Pending(enforceTips bool) (map[common.Address]types.Transactions, error) {
|
||||
func (p *testTxPool) Pending(enforceTips bool) map[common.Address]types.Transactions {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ func (p *testTxPool) Pending(enforceTips bool) (map[common.Address]types.Transac
|
|||
for _, batch := range batches {
|
||||
sort.Sort(types.TxByNonce(batch))
|
||||
}
|
||||
return batches, nil
|
||||
return batches
|
||||
}
|
||||
|
||||
func (p *testTxPool) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ type txPool interface {
|
|||
|
||||
// Pending should return pending transactions.
|
||||
// The slice should be modifiable by the caller.
|
||||
Pending(enforceTips bool) (map[common.Address]types.Transactions, error)
|
||||
Pending(enforceTips bool) map[common.Address]types.Transactions
|
||||
|
||||
// SubscribeNewTxsEvent should return an event subscription of
|
||||
// NewTxsEvent and send events to the given channel.
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ type txsync struct {
|
|||
// syncTransactions starts sending all currently pending transactions to the given peer.
|
||||
func (pm *ProtocolManager) syncTransactions(p *peer) {
|
||||
var txs types.Transactions
|
||||
pending, _ := pm.txpool.Pending(false)
|
||||
pending := pm.txpool.Pending(false)
|
||||
for _, batch := range pending {
|
||||
txs = append(txs, batch...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -679,11 +679,7 @@ func (w *worker) commitNewWork() {
|
|||
log.Error("[commitNewWork] fail to check if block is epoch switch block when fetching pending transactions", "BlockNum", header.Number, "Hash", header.Hash())
|
||||
}
|
||||
if !isEpochSwitchBlock {
|
||||
pending, err := w.eth.TxPool().Pending(true)
|
||||
if err != nil {
|
||||
log.Error("Failed to fetch pending transactions", "err", err)
|
||||
return
|
||||
}
|
||||
pending := w.eth.TxPool().Pending(true)
|
||||
txs, specialTxs = types.NewTransactionsByPriceAndNonce(w.current.signer, pending, signers, feeCapacity)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue