Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderZhi committed Jun 26, 2024
1 parent f98471a commit 7536390
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions action/protocol/staking/vote_reviser.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,9 @@ func (vr *VoteReviser) isCacheExist(height uint64) bool {

// NeedRevise returns true if height needs revise
func (vr *VoteReviser) NeedRevise(height uint64) bool {
if vr.shouldReviseVotes(height) {
return true
}
if vr.shouldReviseAlias(height) {
return true
}
return false
return slices.Contains(vr.cfg.ReviseHeights, height) ||
vr.shouldReviseSelfStakeBuckets(height) ||
vr.shouldReviseAlias(height)
}

// NeedCorrectCands returns true if height needs to correct candidates
Expand All @@ -153,10 +149,6 @@ func (vr *VoteReviser) shouldReviseSelfStakeBuckets(height uint64) bool {
return vr.cfg.SelfStakeBucketReviseHeight == height
}

func (vr *VoteReviser) shouldReviseVotes(height uint64) bool {
return slices.Contains(vr.cfg.ReviseHeights, height) || vr.shouldReviseSelfStakeBuckets(height)
}

func (vr *VoteReviser) calculateVoteWeight(csm CandidateStateManager, height uint64, cands CandidateList) (CandidateList, error) {
csr := newCandidateStateReader(csm.SM())
candm := make(map[string]*Candidate)
Expand Down

0 comments on commit 7536390

Please sign in to comment.