mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 23:02:16 +00:00
25 lines
384 B
Go
25 lines
384 B
Go
|
package types
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
)
|
||
|
|
||
|
// validators implements sort
|
||
|
|
||
|
type Validators []*Validator
|
||
|
|
||
|
func (v Validators) Len() int {
|
||
|
return len(v)
|
||
|
}
|
||
|
|
||
|
// XXX: doesn't distinguish same validator with different power
|
||
|
func (v Validators) Less(i, j int) bool {
|
||
|
return bytes.Compare(v[i].PubKey, v[j].PubKey) <= 0
|
||
|
}
|
||
|
|
||
|
func (v Validators) Swap(i, j int) {
|
||
|
v1 := v[i]
|
||
|
v[i] = v[j]
|
||
|
v[j] = v1
|
||
|
}
|