From bb3f16d487a86e89a863c0ab21b667969c0e3ae4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 12 Jul 2021 18:17:17 +0300 Subject: [PATCH] [#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 --- pkg/innerring/processors/governance/list.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/innerring/processors/governance/list.go b/pkg/innerring/processors/governance/list.go index b5d10ead..6a76a082 100644 --- a/pkg/innerring/processors/governance/list.go +++ b/pkg/innerring/processors/governance/list.go @@ -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