forked from TrueCloudLab/neoneo-go
core: fix (*NEO).getCandidates
Don't need to pay attention to key prefix while sorting.
This commit is contained in:
parent
756785acd3
commit
c13382e27d
1 changed files with 2 additions and 2 deletions
|
@ -734,7 +734,7 @@ func (n *NEO) getCandidates(d dao.DAO, sortByKey bool) ([]keyWithVotes, error) {
|
|||
}
|
||||
}
|
||||
if sortByKey {
|
||||
sort.Slice(arr, func(i, j int) bool { return strings.Compare(arr[i].Key, arr[j].Key) == -1 })
|
||||
sort.Slice(arr, func(i, j int) bool { return strings.Compare(arr[i].Key[1:], arr[j].Key[1:]) == -1 })
|
||||
} else {
|
||||
sort.Slice(arr, func(i, j int) bool {
|
||||
// The most-voted validators should end up in the front of the list.
|
||||
|
@ -743,7 +743,7 @@ func (n *NEO) getCandidates(d dao.DAO, sortByKey bool) ([]keyWithVotes, error) {
|
|||
return cmp > 0
|
||||
}
|
||||
// Ties are broken with public keys.
|
||||
return strings.Compare(arr[i].Key, arr[j].Key) == -1
|
||||
return strings.Compare(arr[i].Key[1:], arr[j].Key[1:]) == -1
|
||||
})
|
||||
}
|
||||
return arr, nil
|
||||
|
|
Loading…
Reference in a new issue