Browse Source

Merge pull request #1382 from EugeneChung/develop

remove Heap.Update() call when setting Proposer field
pull/1604/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
bf6527fc59
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      types/validator_set.go

+ 5
- 4
types/validator_set.go View File

@ -59,13 +59,14 @@ func (valSet *ValidatorSet) IncrementAccum(times int) {
// Decrement the validator with most accum times times
for i := 0; i < times; i++ {
mostest := validatorsHeap.Peek().(*Validator)
// mind underflow
mostest.Accum = safeSubClip(mostest.Accum, valSet.TotalVotingPower())
if i == times-1 {
valSet.Proposer = mostest
} else {
validatorsHeap.Update(mostest, accumComparable{mostest})
}
// mind underflow
mostest.Accum = safeSubClip(mostest.Accum, valSet.TotalVotingPower())
validatorsHeap.Update(mostest, accumComparable{mostest})
}
}


Loading…
Cancel
Save