|
@ -1439,11 +1439,12 @@ func (cs *State) defaultDoPrevote(ctx context.Context, height int64, round int32 |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Validate proposal block
|
|
|
|
|
|
|
|
|
// Validate proposal block, from Tendermint's perspective
|
|
|
err := cs.blockExec.ValidateBlock(cs.state, cs.ProposalBlock) |
|
|
err := cs.blockExec.ValidateBlock(cs.state, cs.ProposalBlock) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
// ProposalBlock is invalid, prevote nil.
|
|
|
// ProposalBlock is invalid, prevote nil.
|
|
|
logger.Error("prevote step: ProposalBlock is invalid; prevoting nil", "err", err) |
|
|
|
|
|
|
|
|
logger.Error("prevote step: consensus deems this block invalid; prevoting nil", |
|
|
|
|
|
"err", err) |
|
|
cs.signAddVote(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{}) |
|
|
cs.signAddVote(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{}) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -1506,6 +1507,30 @@ func (cs *State) defaultDoPrevote(ctx context.Context, height int64, round int32 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
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(ctx, cs.ProposalBlock) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
panic(fmt.Sprintf( |
|
|
|
|
|
"state machine returned an error (%v) when calling ProcessProposal", err, |
|
|
|
|
|
)) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Vote nil if the Application rejected the block
|
|
|
|
|
|
if !stateMachineValidBlock { |
|
|
|
|
|
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(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
logger.Debug("prevote step: ProposalBlock is valid but was not our locked block or " + |
|
|
logger.Debug("prevote step: ProposalBlock is valid but was not our locked block or " + |
|
|
"did not receive a more recent majority; prevoting nil") |
|
|
"did not receive a more recent majority; prevoting nil") |
|
|
cs.signAddVote(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{}) |
|
|
cs.signAddVote(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{}) |
|
|