core: re-enqueue overflow tx to future queue

This commit is contained in:
rjl493456442 2018-05-11 14:47:47 +08:00
parent ed40767355
commit d58702da69

View file

@ -996,16 +996,14 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) {
for i := 0; i < len(offenders)-1; i++ { for i := 0; i < len(offenders)-1; i++ {
list := pool.pending[offenders[i]] list := pool.pending[offenders[i]]
for _, tx := range list.Cap(list.Len() - 1) { for _, tx := range list.Cap(list.Len() - 1) {
// Drop the transaction from the global pools too // Re-enqueue transaction to future queue.
hash := tx.Hash() pool.enqueueTx(tx.Hash(), tx)
pool.all.Remove(hash)
pool.priced.Removed()
// Update the account nonce to the dropped transaction // Update the account nonce to the dropped transaction
if nonce := tx.Nonce(); pool.pendingState.GetNonce(offenders[i]) > nonce { if nonce := tx.Nonce(); pool.pendingState.GetNonce(offenders[i]) > nonce {
pool.pendingState.SetNonce(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-- pending--
} }
@ -1018,16 +1016,14 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) {
for _, addr := range offenders { for _, addr := range offenders {
list := pool.pending[addr] list := pool.pending[addr]
for _, tx := range list.Cap(list.Len() - 1) { for _, tx := range list.Cap(list.Len() - 1) {
// Drop the transaction from the global pools too // Re-enqueue transaction to future queue.
hash := tx.Hash() pool.enqueueTx(tx.Hash(), tx)
pool.all.Remove(hash)
pool.priced.Removed()
// Update the account nonce to the dropped transaction // Update the account nonce to the dropped transaction
if nonce := tx.Nonce(); pool.pendingState.GetNonce(addr) > nonce { if nonce := tx.Nonce(); pool.pendingState.GetNonce(addr) > nonce {
pool.pendingState.SetNonce(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-- pending--
} }