Skip to content

Commit a306239

Browse files
authored
core/filtermaps: use slices.Sort to remove duplicated elements (#32602)
1 parent 41f580f commit a306239

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

core/filtermaps/math.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"fmt"
2323
"hash/fnv"
2424
"math"
25-
"sort"
25+
"slices"
2626

2727
"github.com/ethereum/go-ethereum/common"
2828
)
@@ -245,7 +245,7 @@ func (p *Params) potentialMatches(rows []FilterRow, mapIndex uint32, logValue co
245245
panic("potentialMatches: insufficient list of row alternatives")
246246
}
247247
}
248-
sort.Sort(results)
248+
slices.Sort(results)
249249
// remove duplicates
250250
j := 0
251251
for i, match := range results {
@@ -260,12 +260,7 @@ func (p *Params) potentialMatches(rows []FilterRow, mapIndex uint32, logValue co
260260
// potentialMatches is a strictly monotonically increasing list of log value
261261
// indices in the range of a filter map that are potential matches for certain
262262
// filter criteria.
263-
// potentialMatches implements sort.Interface.
264263
// Note that nil is used as a wildcard and therefore means that all log value
265264
// indices in the filter map range are potential matches. If there are no
266265
// potential matches in the given map's range then an empty slice should be used.
267266
type potentialMatches []uint64
268-
269-
func (p potentialMatches) Len() int { return len(p) }
270-
func (p potentialMatches) Less(i, j int) bool { return p[i] < p[j] }
271-
func (p potentialMatches) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

0 commit comments

Comments
 (0)