Skip to content

Commit d0041ca

Browse files
committed
refactor: use slices.Sort where appropriate
Signed-off-by: hongmengning <hongmengning@outlook.com>
1 parent 398177c commit d0041ca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

db/trie/mptrie/sortedlist.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package mptrie
22

33
import (
4+
"slices"
45
"sort"
56
)
67

@@ -31,9 +32,7 @@ func (sl *SortedList) sort() {
3132
if sl.sorted {
3233
return
3334
}
34-
sort.Slice(sl.li, func(i, j int) bool {
35-
return sl.li[i] < sl.li[j]
36-
})
35+
slices.Sort(sl.li)
3736
sl.sorted = true
3837
}
3938

state/factory/workingset.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package factory
88
import (
99
"context"
1010
"math/big"
11+
"slices"
1112
"sort"
1213
"time"
1314

@@ -455,7 +456,7 @@ func (ws *workingSet) checkNonceContinuity(ctx context.Context, accountNonceMap
455456
if err != nil {
456457
return errors.Wrapf(err, "failed to get the confirmed nonce of address %s", srcAddr)
457458
}
458-
sort.Slice(receivedNonces, func(i, j int) bool { return receivedNonces[i] < receivedNonces[j] })
459+
slices.Sort(receivedNonces)
459460
if useZeroNonce {
460461
pendingNonce = confirmedState.PendingNonceConsideringFreshAccount()
461462
} else {

0 commit comments

Comments
 (0)