consensus: isProposer func

This commit is contained in:
Ethan Buchman
2017-07-11 19:18:15 -04:00
parent e9b7221292
commit 39493bcd9a

View File

@ -804,7 +804,7 @@ func (cs *ConsensusState) enterPropose(height int, round int) {
return 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) cs.Logger.Info("enterPropose: Not our turn to propose", "proposer", cs.Validators.GetProposer().Address, "privValidator", cs.privValidator)
if cs.Validators.HasAddress(cs.privValidator.GetAddress()) { if cs.Validators.HasAddress(cs.privValidator.GetAddress()) {
cs.Logger.Debug("This node is a validator") 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) { func (cs *ConsensusState) defaultDecideProposal(height, round int) {
var block *types.Block var block *types.Block
var blockParts *types.PartSet var blockParts *types.PartSet