mirror of
https://github.com/tendermint/tendermint.git
synced 2026-04-24 09:40:32 +00:00
Addressed Callum's comments
This commit is contained in:
@@ -41,21 +41,11 @@ func (r ResponseQuery) IsErr() bool {
|
||||
return r.Code != CodeTypeOK
|
||||
}
|
||||
|
||||
// IsUnknown returns true if Code is Unknown
|
||||
func (r ResponseProcessProposal) IsUnknown() bool {
|
||||
return r.Result == ResponseProcessProposal_UNKNOWN
|
||||
}
|
||||
|
||||
// IsOK returns true if Code is OK
|
||||
func (r ResponseProcessProposal) IsOK() bool {
|
||||
return r.Result == ResponseProcessProposal_ACCEPT
|
||||
}
|
||||
|
||||
// IsErr returns true if Code is something other than OK.
|
||||
func (r ResponseProcessProposal) IsErr() bool {
|
||||
return r.Result != ResponseProcessProposal_ACCEPT
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// override JSON marshaling so we emit defaults (ie. disable omitempty)
|
||||
|
||||
|
||||
@@ -1267,15 +1267,25 @@ func (cs *State) defaultDoPrevote(height int64, round int32) {
|
||||
return
|
||||
}
|
||||
|
||||
// Validate proposal block
|
||||
// Validate proposal block, from Tendermint's perspective
|
||||
err := cs.blockExec.ValidateBlock(cs.state, cs.ProposalBlock)
|
||||
if err != nil {
|
||||
// ProposalBlock is invalid, prevote nil.
|
||||
logger.Error("prevote step: ProposalBlock is invalid", "err", err)
|
||||
logger.Error("prevote step: consensus deems this block invalid; prevoting nil",
|
||||
"err", err)
|
||||
cs.signAddVote(tmproto.PrevoteType, nil, types.PartSetHeader{})
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
Before prevoting on the block received from the proposer for the current round and height,
|
||||
we request the Application, via `ProcessProposal` ABCI call, to confirm that the block is
|
||||
valid. If the Application does not accept the block, Tendermint prevotes `nil`.
|
||||
|
||||
WARNING: misuse of block rejection by the Application can seriously compromise Tendermint's
|
||||
liveness properties. Please see `PrepareProosal`-`ProcessProposal` coherence and determinism
|
||||
properties in the ABCI++ specification.
|
||||
*/
|
||||
stateMachineValidBlock, err := cs.blockExec.ProcessProposal(cs.ProposalBlock)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf(
|
||||
@@ -1283,10 +1293,10 @@ func (cs *State) defaultDoPrevote(height int64, round int32) {
|
||||
))
|
||||
}
|
||||
|
||||
// Vote nil if application invalidated the block
|
||||
// Vote nil if the Application rejected the block
|
||||
if !stateMachineValidBlock {
|
||||
// Consensus says we must vote nil
|
||||
logger.Error("prevote step: consensus deems this block to be mustVoteNil", "err", err)
|
||||
logger.Error("prevote step: state machine rejected a proposed block; this should not happen:"+
|
||||
"the proposer may be misbehaving; prevoting nil", "err", err)
|
||||
cs.signAddVote(tmproto.PrevoteType, nil, types.PartSetHeader{})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user