Skip to content

Commit

Permalink
fix(builder): sort unindexed constraints by nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Jul 24, 2024
1 parent 09df201 commit 417cd78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builder/miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,11 @@ func (w *worker) commitTransactions(env *environment, plainTxs, blobTxs *transac
return *constraintsOrderedByIndex[i].Index < *constraintsOrderedByIndex[j].Index
})

// Sorts the unindexed constraints by nonce descending (since we'll be popping them from the end)
sort.Slice(constraintsWithoutIndex, func(i, j int) bool {
return constraintsWithoutIndex[i].Tx.Nonce() > constraintsWithoutIndex[j].Tx.Nonce()
})

for {
// `env.tcount` starts from 0 so it's correct to use it as the current index
currentTxIndex := uint64(env.tcount)
Expand Down

0 comments on commit 417cd78

Please sign in to comment.