From b5ac9ede8aff6a92cc0f921dc88b72c988e11701 Mon Sep 17 00:00:00 2001 From: Zarko Milosevic Date: Mon, 14 May 2018 13:45:26 +0200 Subject: [PATCH] Add rules in gossipVotesForHeight to clarify priorities on messages to send --- consensus/reactor.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/consensus/reactor.go b/consensus/reactor.go index e98ad6b8c..9535108c7 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -696,6 +696,16 @@ func (conR *ConsensusReactor) gossipVotesForHeight(logger log.Logger, rs *cstype return true } } + // If there are POL prevotes to send... + if prs.Step <= cstypes.RoundStepPropose && prs.Round != -1 && prs.Round <= rs.Round && prs.ProposalPOLRound != -1 { + if polPrevotes := rs.Votes.Prevotes(prs.ProposalPOLRound); polPrevotes != nil { + if ps.PickSendVote(polPrevotes) { + logger.Debug("Picked rs.Prevotes(prs.ProposalPOLRound) to send", + "round", prs.ProposalPOLRound) + return true + } + } + } // If there are prevotes to send... if prs.Step <= cstypes.RoundStepPrevoteWait && prs.Round != -1 && prs.Round <= rs.Round { if ps.PickSendVote(rs.Votes.Prevotes(prs.Round)) { @@ -710,6 +720,13 @@ func (conR *ConsensusReactor) gossipVotesForHeight(logger log.Logger, rs *cstype return true } } + // If there are prevotes to send...Needed because of validBlock mechanism + if prs.Round != -1 && prs.Round <= rs.Round { + if ps.PickSendVote(rs.Votes.Prevotes(prs.Round)) { + logger.Debug("Picked rs.Prevotes(prs.Round) to send", "round", prs.Round) + return true + } + } // If there are POLPrevotes to send... if prs.ProposalPOLRound != -1 { if polPrevotes := rs.Votes.Prevotes(prs.ProposalPOLRound); polPrevotes != nil {