Add more comments for Valid*
This commit is contained in:
parent
b9c95ac546
commit
48dd1c328c
|
@ -1307,19 +1307,20 @@ func (cs *ConsensusState) addProposalBlockPart(height int64, part *types.Part, v
|
||||||
// NOTE: it's possible to receive complete proposal blocks for future rounds without having the proposal
|
// NOTE: it's possible to receive complete proposal blocks for future rounds without having the proposal
|
||||||
cs.Logger.Info("Received complete proposal block", "height", cs.ProposalBlock.Height, "hash", cs.ProposalBlock.Hash())
|
cs.Logger.Info("Received complete proposal block", "height", cs.ProposalBlock.Height, "hash", cs.ProposalBlock.Hash())
|
||||||
|
|
||||||
// Update ValidBlock
|
// Update Valid* if we can.
|
||||||
prevotes := cs.Votes.Prevotes(cs.Round)
|
prevotes := cs.Votes.Prevotes(cs.Round)
|
||||||
blockID, ok := prevotes.TwoThirdsMajority()
|
blockID, hasTwoThirds := prevotes.TwoThirdsMajority()
|
||||||
if ok && !blockID.IsZero() && (cs.ValidRound < cs.Round) {
|
if hasTwoThirds && !blockID.IsZero() && (cs.ValidRound < cs.Round) {
|
||||||
// update valid value
|
|
||||||
if cs.ProposalBlock.HashesTo(blockID.Hash) {
|
if cs.ProposalBlock.HashesTo(blockID.Hash) {
|
||||||
cs.ValidRound = cs.Round
|
cs.ValidRound = cs.Round
|
||||||
cs.ValidBlock = cs.ProposalBlock
|
cs.ValidBlock = cs.ProposalBlock
|
||||||
cs.ValidBlockParts = cs.ProposalBlockParts
|
cs.ValidBlockParts = cs.ProposalBlockParts
|
||||||
}
|
}
|
||||||
//TODO: In case there is +2/3 majority in Prevotes set for some block and cs.ProposalBlock contains different block,
|
// TODO: In case there is +2/3 majority in Prevotes set for some
|
||||||
//either proposer is faulty or voting power of faulty processes is more than 1/3. We should
|
// block and cs.ProposalBlock contains different block, either
|
||||||
//trigger in the future accountability procedure at this point.
|
// proposer is faulty or voting power of faulty processes is more
|
||||||
|
// than 1/3. We should trigger in the future accountability
|
||||||
|
// procedure at this point.
|
||||||
}
|
}
|
||||||
|
|
||||||
if cs.Step == cstypes.RoundStepPropose && cs.isProposalComplete() {
|
if cs.Step == cstypes.RoundStepPropose && cs.isProposalComplete() {
|
||||||
|
|
|
@ -67,9 +67,9 @@ type RoundState struct {
|
||||||
LockedRound int
|
LockedRound int
|
||||||
LockedBlock *types.Block
|
LockedBlock *types.Block
|
||||||
LockedBlockParts *types.PartSet
|
LockedBlockParts *types.PartSet
|
||||||
ValidRound int
|
ValidRound int // Last known round with POL for non-nil valid block.
|
||||||
ValidBlock *types.Block
|
ValidBlock *types.Block // Last known block of POL mentioned above.
|
||||||
ValidBlockParts *types.PartSet
|
ValidBlockParts *types.PartSet // Last known block parts of POL metnioned above.
|
||||||
Votes *HeightVoteSet
|
Votes *HeightVoteSet
|
||||||
CommitRound int //
|
CommitRound int //
|
||||||
LastCommit *types.VoteSet // Last precommits at Height-1
|
LastCommit *types.VoteSet // Last precommits at Height-1
|
||||||
|
|
Loading…
Reference in New Issue