mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
core/txpool/locals: fix unsafe nonce comparator in TxTracker.recheck journal sort
This commit is contained in:
parent
960c87a944
commit
fbae079252
1 changed files with 7 additions and 1 deletions
|
|
@ -151,7 +151,13 @@ func (tracker *TxTracker) recheck(journalCheck bool) []*types.Transaction {
|
|||
for _, list := range rejournal {
|
||||
// cmp(a, b) should return a negative number when a < b,
|
||||
slices.SortFunc(list, func(a, b *types.Transaction) int {
|
||||
return int(a.Nonce() - b.Nonce())
|
||||
if a.Nonce() < b.Nonce() {
|
||||
return -1
|
||||
}
|
||||
if a.Nonce() > b.Nonce() {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
})
|
||||
}
|
||||
// Rejournal the tracker while holding the lock. No new transactions will
|
||||
|
|
|
|||
Loading…
Reference in a new issue