From a3062390f760eb5c8dd7a8f39e92a75ec43d6933 Mon Sep 17 00:00:00 2001 From: hero5512 Date: Sun, 14 Sep 2025 22:42:14 -0400 Subject: [PATCH] core/filtermaps: use slices.Sort to remove duplicated elements (#32602) --- core/filtermaps/math.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/filtermaps/math.go b/core/filtermaps/math.go index 33ac07f721..68fd6debd6 100644 --- a/core/filtermaps/math.go +++ b/core/filtermaps/math.go @@ -22,7 +22,7 @@ import ( "fmt" "hash/fnv" "math" - "sort" + "slices" "github.com/ethereum/go-ethereum/common" ) @@ -245,7 +245,7 @@ func (p *Params) potentialMatches(rows []FilterRow, mapIndex uint32, logValue co panic("potentialMatches: insufficient list of row alternatives") } } - sort.Sort(results) + slices.Sort(results) // remove duplicates j := 0 for i, match := range results { @@ -260,12 +260,7 @@ func (p *Params) potentialMatches(rows []FilterRow, mapIndex uint32, logValue co // potentialMatches is a strictly monotonically increasing list of log value // indices in the range of a filter map that are potential matches for certain // filter criteria. -// potentialMatches implements sort.Interface. // Note that nil is used as a wildcard and therefore means that all log value // indices in the filter map range are potential matches. If there are no // potential matches in the given map's range then an empty slice should be used. type potentialMatches []uint64 - -func (p potentialMatches) Len() int { return len(p) } -func (p potentialMatches) Less(i, j int) bool { return p[i] < p[j] } -func (p potentialMatches) Swap(i, j int) { p[i], p[j] = p[j], p[i] }