Commit 6153cd8b authored by laser's avatar laser
Browse files

feat(sorting): sort sector info by id

parent b7280d07
package go_sectorbuilder package go_sectorbuilder
import ( import (
"bytes"
"encoding/json" "encoding/json"
"os" "os"
"runtime" "runtime"
...@@ -39,7 +38,7 @@ type SortedSectorInfo struct { ...@@ -39,7 +38,7 @@ type SortedSectorInfo struct {
// NewSortedSectorInfo returns a SortedSectorInfo // NewSortedSectorInfo returns a SortedSectorInfo
func NewSortedSectorInfo(sectorInfo ...SectorInfo) SortedSectorInfo { func NewSortedSectorInfo(sectorInfo ...SectorInfo) SortedSectorInfo {
fn := func(i, j int) bool { fn := func(i, j int) bool {
return bytes.Compare(sectorInfo[i].CommR[:], sectorInfo[j].CommR[:]) == -1 return sectorInfo[i].SectorID < sectorInfo[j].SectorID
} }
sort.Slice(sectorInfo[:], fn) sort.Slice(sectorInfo[:], fn)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment