Skip to content

Commit

Permalink
Merge 0821484 into 67cdfa9
Browse files Browse the repository at this point in the history
  • Loading branch information
elvis88 committed May 5, 2019
2 parents 67cdfa9 + 0821484 commit 4f79c58
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions consensus/dpos/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,24 @@ func (sys *System) UpdateElectedCandidates(pepcho uint64, epcho uint64, height u
}

if !pstate.Dpos {
if pstate.Epcho != pstate.PreEpcho {
ppstate, err := sys.GetState(pstate.PreEpcho)
if err != nil {
return err
}
activeTotalQuantity = big.NewInt(0)
activatedCandidateSchedule = ppstate.ActivatedCandidateSchedule
for _, candidate := range activatedCandidateSchedule {
candidateInfo, err := sys.GetCandidate(candidate)
if err != nil {
return err
}
if candidateInfo == nil {
continue
}
activeTotalQuantity = new(big.Int).Add(activeTotalQuantity, candidateInfo.Quantity)
}
}
if init := len(activatedCandidateSchedule); init > 0 {
index := 0
for uint64(len(activatedCandidateSchedule)) < sys.config.CandidateScheduleSize {
Expand Down

0 comments on commit 4f79c58

Please sign in to comment.