mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
core/filtermaps: use slices.SortFunc for endpoints
This commit is contained in:
parent
23c3498836
commit
fb694f2074
1 changed files with 9 additions and 2 deletions
|
|
@ -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,15 @@ 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 {
|
||||||
|
if a.m < b.m {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
if a.m > b.m {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
})
|
||||||
var (
|
var (
|
||||||
sum int
|
sum int
|
||||||
merged []uint32
|
merged []uint32
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue