From 2c445059f2379a75a6e10c9da75b3ea428f6d5f4 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 19 Mar 2018 14:10:25 +0300 Subject: [PATCH] mark peer as good every blocksToContributeToBecomeGoodPeer blocks if enough peers are marked good eventually some will become unmarked, so good to have a force that will continue to cycle them back into good territory! Refs #1317 --- consensus/reactor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consensus/reactor.go b/consensus/reactor.go index 60ac3d9c9..a265f76c0 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -253,7 +253,7 @@ func (conR *ConsensusReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) ps.ApplyProposalPOLMessage(msg) case *BlockPartMessage: ps.SetHasProposalBlockPart(msg.Height, msg.Round, msg.Part.Index) - if numBlocks := ps.RecordBlockPart(msg); numBlocks == blocksToContributeToBecomeGoodPeer { + if numBlocks := ps.RecordBlockPart(msg); numBlocks%blocksToContributeToBecomeGoodPeer == 0 { conR.Switch.MarkPeerAsGood(src) } conR.conS.peerMsgQueue <- msgInfo{msg, src.ID()} @@ -275,7 +275,7 @@ func (conR *ConsensusReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) ps.EnsureVoteBitArrays(height, valSize) ps.EnsureVoteBitArrays(height-1, lastCommitSize) ps.SetHasVote(msg.Vote) - if blocks := ps.RecordVote(msg.Vote); blocks == blocksToContributeToBecomeGoodPeer { + if blocks := ps.RecordVote(msg.Vote); blocks%blocksToContributeToBecomeGoodPeer == 0 { conR.Switch.MarkPeerAsGood(src) }