core: use slices package for sorting (#27489)

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Dan Laine
2023-06-20 11:58:47 +02:00
committed by GitHub
co-authored by Felix Lange
parent 84b05d4f34
commit 154b016b6c
8 changed files with 39 additions and 94 deletions
+3 -3
View File
@@ -24,13 +24,13 @@ import (
"math"
"math/big"
"reflect"
"sort"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"golang.org/x/exp/slices"
)
var (
@@ -270,8 +270,8 @@ func gatherForks(config *params.ChainConfig) ([]uint64, []uint64) {
}
}
}
sort.Slice(forksByBlock, func(i, j int) bool { return forksByBlock[i] < forksByBlock[j] })
sort.Slice(forksByTime, func(i, j int) bool { return forksByTime[i] < forksByTime[j] })
slices.Sort(forksByBlock)
slices.Sort(forksByTime)
// Deduplicate fork identifiers applying multiple forks
for i := 1; i < len(forksByBlock); i++ {