Merge pull request #1382 from EugeneChung/develop

remove Heap.Update() call when setting Proposer field
This commit is contained in:
Ethan Buchman 2018-05-20 19:32:13 -04:00 committed by GitHub
commit bf6527fc59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

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)
if i == times-1 {
valSet.Proposer = mostest
}
// mind underflow
mostest.Accum = safeSubClip(mostest.Accum, valSet.TotalVotingPower())
validatorsHeap.Update(mostest, accumComparable{mostest})
if i == times-1 {
valSet.Proposer = mostest
} else {
validatorsHeap.Update(mostest, accumComparable{mostest})
}
}
}