mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-24 19:25:21 +00:00
Merge pull request #1639 from nspcc-dev/preview4-fixes-2
core: fix (*NEO).getCandidates
This commit is contained in:
commit
c1409844f5
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 {
|
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 {
|
} else {
|
||||||
sort.Slice(arr, func(i, j int) bool {
|
sort.Slice(arr, func(i, j int) bool {
|
||||||
// The most-voted validators should end up in the front of the list.
|
// 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
|
return cmp > 0
|
||||||
}
|
}
|
||||||
// Ties are broken with public keys.
|
// 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
|
return arr, nil
|
||||||
|
|
Loading…
Reference in a new issue