change to use slices.SortFunc

This commit is contained in:
maskpp 2024-06-25 20:45:41 +08:00
parent a4b7a65ac9
commit 1b2082942a

View file

@ -17,10 +17,9 @@
package blobpool package blobpool
import ( import (
"bytes"
"container/heap" "container/heap"
"math" "math"
"sort" "slices"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/holiman/uint256" "github.com/holiman/uint256"
@ -56,7 +55,7 @@ func newPriceHeap(basefee *uint256.Int, blobfee *uint256.Int, index *map[common.
// but it makes the heap initialization deterministic and less annoying to // but it makes the heap initialization deterministic and less annoying to
// test in unit tests. // test in unit tests.
addrs := maps.Keys(*index) addrs := maps.Keys(*index)
sort.Slice(addrs, func(i, j int) bool { return bytes.Compare(addrs[i][:], addrs[j][:]) < 0 }) slices.SortFunc(addrs, common.Address.Cmp)
heap.addrs = addrs heap.addrs = addrs
for i, addr := range addrs { for i, addr := range addrs {