From d58702da694ffdee502001625df4a7114e9723fb Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Fri, 11 May 2018 14:47:47 +0800 Subject: [PATCH] core: re-enqueue overflow tx to future queue --- core/tx_pool.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 7393c8286f..f4042959b4 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -996,16 +996,14 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) { for i := 0; i < len(offenders)-1; i++ { list := pool.pending[offenders[i]] for _, tx := range list.Cap(list.Len() - 1) { - // Drop the transaction from the global pools too - hash := tx.Hash() - pool.all.Remove(hash) - pool.priced.Removed() + // Re-enqueue transaction to future queue. + pool.enqueueTx(tx.Hash(), tx) // Update the account nonce to the dropped transaction if nonce := tx.Nonce(); pool.pendingState.GetNonce(offenders[i]) > nonce { pool.pendingState.SetNonce(offenders[i], nonce) } - log.Trace("Removed fairness-exceeding pending transaction", "hash", hash) + log.Trace("Re-enqueue fairness-exceeding pending transaction", "hash", tx.Hash()) } pending-- } @@ -1018,16 +1016,14 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) { for _, addr := range offenders { list := pool.pending[addr] for _, tx := range list.Cap(list.Len() - 1) { - // Drop the transaction from the global pools too - hash := tx.Hash() - pool.all.Remove(hash) - pool.priced.Removed() + // Re-enqueue transaction to future queue. + pool.enqueueTx(tx.Hash(), tx) // Update the account nonce to the dropped transaction if nonce := tx.Nonce(); pool.pendingState.GetNonce(addr) > nonce { pool.pendingState.SetNonce(addr, nonce) } - log.Trace("Removed fairness-exceeding pending transaction", "hash", hash) + log.Trace("Re-enqueue fairness-exceeding pending transaction", "hash", tx.Hash()) } pending-- }