core/filtermaps: use slices.SortFunc for endpoints

This commit is contained in:
Lessa 2026-01-16 02:06:50 -05:00 committed by GitHub
parent 23c3498836
commit fb694f2074
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,7 +21,6 @@ import (
"fmt"
"math"
"slices"
"sort"
"time"
"github.com/ethereum/go-ethereum/common"
@ -616,7 +615,15 @@ func (fmr *filterMapsRange) addRenderedRange(firstRendered, afterLastRendered, a
if fmr.tailPartialEpoch > 0 {
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 {
if a.m < b.m {
return -1
}
if a.m > b.m {
return 1
}
return 0
})
var (
sum int
merged []uint32