mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
core/txpool/legacypool: fix tx removal
promoteExecutable already removes the txs from the queue. We just need to remove them from the lookup. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
39ce64b8b0
commit
f2b434bbf9
2 changed files with 17 additions and 1 deletions
|
|
@ -1413,8 +1413,18 @@ func (pool *LegacyPool) promoteExecutables(accounts []common.Address) []*types.T
|
|||
|
||||
// remove all removable transactions
|
||||
for _, hash := range removeable {
|
||||
pool.removeTx(hash, true, true)
|
||||
pool.all.Remove(hash)
|
||||
}
|
||||
|
||||
// release all accounts that have no more transactions in the pool
|
||||
for _, addr := range accounts {
|
||||
_, hasPending := pool.pending[addr]
|
||||
_, hasQueued := pool.queue.get(addr)
|
||||
if !hasPending && !hasQueued {
|
||||
pool.reserver.Release(addr)
|
||||
}
|
||||
}
|
||||
|
||||
return promoted
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,12 @@ func (q *queue) add(hash common.Hash, tx *types.Transaction) (*common.Hash, erro
|
|||
return &h, nil
|
||||
}
|
||||
|
||||
// promoteExecutables iterates over all accounts with queued transactions, selecting
|
||||
// for promotion any that are now executable. It also drops any transactions that are
|
||||
// deemed too old (nonce too low) or too costly (insufficient funds or over gas limit).
|
||||
//
|
||||
// Returns two lists: all transactions that were removed from the queue and selected
|
||||
// for promotion; all other transactions that were removed from the queue and dropped.
|
||||
func (q *queue) promoteExecutables(accounts []common.Address, gasLimit uint64, currentState *state.StateDB, nonces *noncer) ([]*types.Transaction, []common.Hash) {
|
||||
// Track the promoteable transactions to broadcast them at once
|
||||
var promoteable []*types.Transaction
|
||||
|
|
|
|||
Loading…
Reference in a new issue