mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-28 18:10:20 +00:00
Ensure correct peer vote bitarray capacity
This commit is contained in:
@@ -383,8 +383,10 @@ OUTER_LOOP:
|
||||
prs := ps.GetRoundState()
|
||||
|
||||
trySendVote := func(voteSet *VoteSet, peerVoteSet BitArray) (sent bool) {
|
||||
// Initialize Prevotes/Precommits/Commits if needed
|
||||
ps.EnsureVoteBitArrays(prs.Height, voteSet.Size())
|
||||
if prs.Height == voteSet.Height() {
|
||||
// Initialize Prevotes/Precommits/Commits if needed
|
||||
ps.EnsureVoteBitArrays(prs.Height, voteSet.Size())
|
||||
}
|
||||
|
||||
// TODO: give priority to our vote.
|
||||
if index, ok := voteSet.BitArray().Sub(peerVoteSet.Copy()).PickRandom(); ok {
|
||||
|
||||
@@ -54,6 +54,14 @@ func NewVoteSet(height uint, round uint, type_ byte, valSet *sm.ValidatorSet) *V
|
||||
}
|
||||
}
|
||||
|
||||
func (voteSet *VoteSet) Height() uint {
|
||||
if voteSet == nil {
|
||||
return 0
|
||||
} else {
|
||||
return voteSet.height
|
||||
}
|
||||
}
|
||||
|
||||
func (voteSet *VoteSet) Size() uint {
|
||||
if voteSet == nil {
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user