[#688] pkg/ir/governance: Add public key sorting

Add sorting of passed public keys in `newAlphabetList`
function before Alphabet list merge to make returned
results more expected.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-07-12 18:17:17 +03:00 committed by Alex Vanin
parent 361bff216a
commit bb3f16d487

View file

@ -19,7 +19,12 @@ var (
// sidechain list is empty. Function returns `errNotEnoughKeys` if mainnet
// list contains less keys than sidechain list. Function returns (nil, nil) if
// mainnet list contains all keys from sidechain list.
//
// Sorts passed slices.
func newAlphabetList(sidechain, mainnet keys.PublicKeys) (keys.PublicKeys, error) {
sort.Sort(sidechain)
sort.Sort(mainnet)
ln := len(sidechain)
if ln == 0 {
return nil, errEmptySidechain