Skip to content

Commit

Permalink
fix: ballot sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Feb 18, 2023
1 parent 95924b6 commit 42a92ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x/oracle/types/ballot.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ func (pb ExchangeRateBallot) Len() int {
// Less reports whether the element with
// index i should sort before the element with index j.
func (pb ExchangeRateBallot) Less(i, j int) bool {
return pb[i].ExchangeRate.LT(pb[j].ExchangeRate)
if pb[i].ExchangeRate.LT(pb[j].ExchangeRate) {
return true
}
if pb[i].ExchangeRate.Equal(pb[j].ExchangeRate) {
return bytes.Compare(pb[i].Voter, pb[j].Voter) < 0
}
return false
}

// Swap implements sort.Interface.
Expand Down

0 comments on commit 42a92ff

Please sign in to comment.