mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-01 13:47:07 +00:00
consensus: check that proposal is non-nil before voting (#7480)
This commit is contained in:
@@ -1369,6 +1369,12 @@ func (cs *State) defaultDoPrevote(ctx context.Context, height int64, round int32
|
||||
return
|
||||
}
|
||||
|
||||
if cs.Proposal == nil || cs.ProposalBlock == nil {
|
||||
logger.Debug("prevote step; did not receive proposal, prevoting nil")
|
||||
cs.signAddVote(tmproto.PrevoteType, nil, types.PartSetHeader{})
|
||||
return
|
||||
}
|
||||
|
||||
if !cs.Proposal.Timestamp.Equal(cs.ProposalBlock.Header.Time) {
|
||||
logger.Debug("proposal timestamp not equal, prevoting nil")
|
||||
cs.signAddVote(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{})
|
||||
@@ -1537,6 +1543,13 @@ func (cs *State) enterPrecommit(ctx context.Context, height int64, round int32)
|
||||
}
|
||||
// At this point, +2/3 prevoted for a particular block.
|
||||
|
||||
// If we never received a proposal for this block, we must precommit nil
|
||||
if cs.Proposal == nil || cs.ProposalBlock == nil {
|
||||
logger.Debug("precommit step; did not receive proposal, precommitting nil")
|
||||
cs.signAddVote(tmproto.PrecommitType, nil, types.PartSetHeader{})
|
||||
return
|
||||
}
|
||||
|
||||
// If the proposal time does not match the block time, precommit nil.
|
||||
if !cs.Proposal.Timestamp.Equal(cs.ProposalBlock.Header.Time) {
|
||||
logger.Debug("proposal timestamp not equal, precommitting nil")
|
||||
|
||||
Reference in New Issue
Block a user