Skip to content

Commit

Permalink
fix iotexproject#2 isssue
Browse files Browse the repository at this point in the history
  • Loading branch information
Liuhaai committed Dec 19, 2023
1 parent 301011d commit 3fa5ee5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions actpool/actqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,9 @@ func (q *actQueue) cleanTimeout() []action.SealedEnvelope {
size = len(q.ascQueue)
)
for i := 0; i < size; {
// TODO: keep consequence nonce actions
if timeNow.After(q.ascQueue[i].deadline) {
// only remove the action if it is timed out and nonce is larger than pendingNonce
if timeNow.After(q.ascQueue[i].deadline) && nonce >= q.pendingNonce{

This comment has been minimized.

Copy link
@dustinxie

dustinxie Dec 19, 2023

confirmedNonce = 3, queue has 4-9, and 11-20, q.pendingNonce = 10

  1. should be nonce > q.pendingNonce? if a tx has nonce = 10, it will bridge the gap of 9 and 11, we don't want to delete that
  2. L170 above can remove q.updateFromNonce(q.pendingNonce)? since now q.pendingNonce won't change, so no need to update again
nonce := q.ascQueue[i].nonce
if nonce < q.pendingNonce {
q.pendingNonce = nonce
}
removedFromQueue = append(removedFromQueue, q.items[nonce])
delete(q.items, nonce)
delete(q.pendingBalance, nonce)
Expand Down

0 comments on commit 3fa5ee5

Please sign in to comment.