mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-26 23:32:15 +00:00
fix HeightVoteSet SetRound(0) bug which wipes out Prevotes; More logging for consensus/state addVote()
This commit is contained in:
parent
16a1404cfe
commit
1a1b9aaaab
@ -69,7 +69,7 @@ func (hvs *HeightVoteSet) SetRound(round int) {
|
|||||||
if _, ok := hvs.roundVoteSets[r]; ok {
|
if _, ok := hvs.roundVoteSets[r]; ok {
|
||||||
continue // Already exists because peerCatchupRounds.
|
continue // Already exists because peerCatchupRounds.
|
||||||
}
|
}
|
||||||
hvs.addRound(round)
|
hvs.addRound(r)
|
||||||
}
|
}
|
||||||
hvs.round = round
|
hvs.round = round
|
||||||
}
|
}
|
||||||
|
@ -1054,6 +1054,8 @@ func (cs *ConsensusState) AddVote(address []byte, vote *types.Vote, peerKey stri
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey string) (added bool, index int, err error) {
|
func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey string) (added bool, index int, err error) {
|
||||||
|
log.Debug("addVote", "voteHeight", vote.Height, "voteType", vote.Type, "csHeight", cs.Height)
|
||||||
|
|
||||||
// A precommit for the previous height?
|
// A precommit for the previous height?
|
||||||
if vote.Height+1 == cs.Height && vote.Type == types.VoteTypePrecommit {
|
if vote.Height+1 == cs.Height && vote.Type == types.VoteTypePrecommit {
|
||||||
added, index, err = cs.LastCommit.AddByAddress(address, vote)
|
added, index, err = cs.LastCommit.AddByAddress(address, vote)
|
||||||
@ -1129,10 +1131,12 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey stri
|
|||||||
panic(Fmt("Unexpected vote type %X", vote.Type)) // Should not happen.
|
panic(Fmt("Unexpected vote type %X", vote.Type)) // Should not happen.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Either duplicate, or error upon cs.Votes.AddByAddress()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Height mismatch, bad peer? TODO
|
// Height mismatch, bad peer?
|
||||||
|
log.Debug("Vote ignored and not added", "voteHeight", vote.Height, "csHeight", cs.Height)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user