core/filtermaps: using slices.SortFunc

This commit is contained in:
cuiweixie 2025-09-20 13:29:13 +08:00
parent 684f0db4a2
commit 9eeb22c32d

View file

@ -21,7 +21,6 @@ import (
"fmt" "fmt"
"math" "math"
"slices" "slices"
"sort"
"time" "time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -616,7 +615,10 @@ func (fmr *filterMapsRange) addRenderedRange(firstRendered, afterLastRendered, a
if fmr.tailPartialEpoch > 0 { if fmr.tailPartialEpoch > 0 {
endpoints = append(endpoints, []endpoint{{fmr.maps.First() - mapsPerEpoch, 1}, {fmr.maps.First() - mapsPerEpoch + fmr.tailPartialEpoch, -1}}...) endpoints = append(endpoints, []endpoint{{fmr.maps.First() - mapsPerEpoch, 1}, {fmr.maps.First() - mapsPerEpoch + fmr.tailPartialEpoch, -1}}...)
} }
sort.Slice(endpoints, func(i, j int) bool { return endpoints[i].m < endpoints[j].m }) slices.SortFunc(endpoints, func(a, b endpoint) int {
return int(a.m) - int(b.m)
})
var ( var (
sum int sum int
merged []uint32 merged []uint32