diff --git a/actpool/actqueue.go b/actpool/actqueue.go index 711642a863..b34d409970 100644 --- a/actpool/actqueue.go +++ b/actpool/actqueue.go @@ -149,10 +149,6 @@ func (q *actQueue) updateFromNonce(start uint64) { } cost, _ := act.Cost() - if balance.Cmp(cost) < 0 { - break - } - balance = new(big.Int).Sub(balance, cost) q.pendingBalance[start+1] = new(big.Int).Set(balance) } @@ -182,7 +178,7 @@ func (q *actQueue) cleanTimeout() []*action.SealedEnvelope { ) for i := 0; i < size; { nonce := q.ascQueue[i].nonce - if timeNow.After(q.ascQueue[i].deadline) && nonce > q.pendingNonce { + if timeNow.After(q.ascQueue[i].deadline) { removedFromQueue = append(removedFromQueue, q.items[nonce]) delete(q.items, nonce) delete(q.pendingBalance, nonce) diff --git a/actpool/queueworker.go b/actpool/queueworker.go index 3ccf3b3730..43da5ee869 100644 --- a/actpool/queueworker.go +++ b/actpool/queueworker.go @@ -130,8 +130,6 @@ func (worker *queueWorker) Handle(job workerJob) error { } } - worker.removeEmptyAccounts() - return err } @@ -253,6 +251,7 @@ func (worker *queueWorker) Reset(ctx context.Context) { worker.emptyAccounts.Set(from, struct{}{}) } }) + worker.removeEmptyAccounts() } // PendingActions returns all accepted actions diff --git a/state/factory/workingset.go b/state/factory/workingset.go index 14f9c6cd3f..7c8401bae7 100644 --- a/state/factory/workingset.go +++ b/state/factory/workingset.go @@ -561,6 +561,12 @@ func (ws *workingSet) pickAndRunActions( case nil: // do nothing case action.ErrChainID: + caller := nextAction.SenderAddress() + if caller == nil { + return nil, errors.New("failed to get address") + } + ap.DeleteAction(caller) + actionIterator.PopAccount() continue case action.ErrGasLimit: actionIterator.PopAccount()