[effective] Ensure stable sort of median (#1959)

pull/1960/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent 67f2e4f57f
commit 2a797b0262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      staking/effective/calculate.go

@ -74,7 +74,7 @@ func median(stakes []SlotPurchase) numeric.Dec {
sort.SliceStable( sort.SliceStable(
stakes, stakes,
func(i, j int) bool { return stakes[i].Dec.LTE(stakes[j].Dec) }, func(i, j int) bool { return stakes[i].Dec.LT(stakes[j].Dec) },
) )
const isEven = 0 const isEven = 0
switch l := len(stakes); l % 2 { switch l := len(stakes); l % 2 {

Loading…
Cancel
Save