diff --git a/consensus/state.go b/consensus/state.go index 415f6af3f..6259a620b 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -804,7 +804,7 @@ func (cs *ConsensusState) enterPropose(height int, round int) { return } - if !bytes.Equal(cs.Validators.GetProposer().Address, cs.privValidator.GetAddress()) { + if !cs.isProposer() { cs.Logger.Info("enterPropose: Not our turn to propose", "proposer", cs.Validators.GetProposer().Address, "privValidator", cs.privValidator) if cs.Validators.HasAddress(cs.privValidator.GetAddress()) { cs.Logger.Debug("This node is a validator") @@ -818,6 +818,10 @@ func (cs *ConsensusState) enterPropose(height int, round int) { } } +func (cs *ConsensusState) isProposer() bool { + return bytes.Equal(cs.Validators.GetProposer().Address, cs.privValidator.GetAddress()) +} + func (cs *ConsensusState) defaultDecideProposal(height, round int) { var block *types.Block var blockParts *types.PartSet