Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actpool actions clean up #4202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions actpool/actqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions actpool/queueworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ func (worker *queueWorker) Handle(job workerJob) error {
}
}

worker.removeEmptyAccounts()

return err
}

Expand Down Expand Up @@ -253,6 +251,7 @@ func (worker *queueWorker) Reset(ctx context.Context) {
worker.emptyAccounts.Set(from, struct{}{})
}
})
worker.removeEmptyAccounts()
}

// PendingActions returns all accepted actions
Expand Down
6 changes: 6 additions & 0 deletions state/factory/workingset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also call ap.DeleteAction(caller) here? like L568 above

Expand Down
Loading