core: update txpool tests for the removal fix

This commit is contained in:
Péter Szilágyi
2018-03-07 10:55:59 +02:00
parent f8601430fd
commit 2b5d1a4a4c
2 changed files with 112 additions and 53 deletions

View File

@ -877,17 +877,15 @@ func (pool *TxPool) removeTx(hash common.Hash) {
// Remove the transaction from the pending lists and reset the account nonce
if pending := pool.pending[addr]; pending != nil {
if removed, invalids := pending.Remove(tx); removed {
// If no more transactions are left, remove the list
// If no more pending transactions are left, remove the list
if pending.Empty() {
delete(pool.pending, addr)
delete(pool.beats, addr)
}
// Otherwise postpone any invalidated transactions
// Postpone any invalidated transactions
for _, tx := range invalids {
pool.enqueueTx(tx.Hash(), tx)
}
// Update the account nonce if needed
if nonce := tx.Nonce(); pool.pendingState.GetNonce(addr) > nonce {
pool.pendingState.SetNonce(addr, nonce)