}
}
}
- /*
- if height > 1 {
- headerExtra.ModifyPredecessorVotes = d.processPredecessorVoter(headerExtra.ModifyPredecessorVotes, stake, from, to, snap)
- }
- */
}
}
}
func (d *Dpos) processEventVote(currentBlockVotes []Vote, stake uint64, voter, to string) []Vote {
-
- //if new(big.Int).SetUint64(stake).Cmp(d.config.MinVoterBalance) > 0 {
- currentBlockVotes = append(currentBlockVotes, Vote{
- Voter: voter,
- Candidate: to,
- Stake: stake,
- })
- //}
+ if stake >= d.config.MinVoterBalance {
+ currentBlockVotes = append(currentBlockVotes, Vote{
+ Voter: voter,
+ Candidate: to,
+ Stake: stake,
+ })
+ }
return currentBlockVotes
}
if extraVanity+extraSeal > len(confirmedHeader.Extra) {
return currentBlockConfirmations
}
- //err = rlp.DecodeBytes(confirmedHeader.Extra[extraVanity:len(confirmedHeader.Extra)-extraSeal], &confirmedHeaderExtra)
if err := json.Unmarshal(confirmedHeader.Extra[extraVanity:len(confirmedHeader.Extra)-extraSeal], &confirmedHeaderExtra); err != nil {
log.Info("Fail to decode parent header", "err", err)
return currentBlockConfirmations
return currentBlockConfirmations
}
-
-func (d *Dpos) processPredecessorVoter(modifyPredecessorVotes []Vote, stake uint64, voter, to string, snap *Snapshot) []Vote {
- if stake > 0 {
- if snap.isVoter(voter) {
- modifyPredecessorVotes = append(modifyPredecessorVotes, Vote{
- Voter: voter,
- Candidate: "",
- Stake: stake,
- })
- }
- if snap.isVoter(to) {
- modifyPredecessorVotes = append(modifyPredecessorVotes, Vote{
- Voter: to,
- Candidate: "",
- Stake: stake,
- })
- }
-
- }
- return modifyPredecessorVotes
-}