core/dao: remove unnecessary slice type

It is used only once, so a simple `sort.Slice`
invocation will suffice.
This commit is contained in:
Evgenii Stratonikov 2020-04-07 12:49:23 +03:00
parent 030b7754ad
commit a71cd0961e
2 changed files with 1 additions and 9 deletions

View file

@ -537,7 +537,7 @@ func (dao *Simple) GetHeaderHashes() ([]util.Uint256, error) {
for k := range hashMap {
sortedKeys = append(sortedKeys, k)
}
sort.Sort(slice(sortedKeys))
sort.Slice(sortedKeys, func(i, j int) bool { return sortedKeys[i] < sortedKeys[j] })
for _, key := range sortedKeys {
hashes = append(hashes[:key], hashMap[key]...)

View file

@ -1,8 +0,0 @@
package dao
// slice attaches the methods of Interface to []int, sorting in increasing order.
type slice []uint32
func (p slice) Len() int { return len(p) }
func (p slice) Less(i, j int) bool { return p[i] < p[j] }
func (p slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }