From 726528e83e87b243ff883fd466804e222cbbb442 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Sat, 20 Sep 2025 13:32:08 +0800 Subject: [PATCH] eth/fetcher: using slices.SortFunc --- eth/fetcher/tx_fetcher.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eth/fetcher/tx_fetcher.go b/eth/fetcher/tx_fetcher.go index 3e050320e9..eef3c20624 100644 --- a/eth/fetcher/tx_fetcher.go +++ b/eth/fetcher/tx_fetcher.go @@ -21,6 +21,7 @@ import ( "fmt" "math" mrand "math/rand" + "slices" "sort" "time" @@ -1014,8 +1015,8 @@ func (f *TxFetcher) forEachAnnounce(announces map[common.Hash]*txMetadataWithSeq for hash, entry := range announces { list = append(list, announcement{hash: hash, meta: entry.txMetadata, seq: entry.seq}) } - sort.Slice(list, func(i, j int) bool { - return list[i].seq < list[j].seq + slices.SortFunc(list, func(a, b announcement) int { + return int(a.seq) - int(b.seq) }) for i := range list { if !do(list[i].hash, list[i].meta) {