Browse Source

mark peer as good only once

or should we do it every N blocks?
Refs #1317
pull/1333/head
Anton Kaliaev 7 years ago
parent
commit
31f3dd42e7
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      consensus/reactor.go

+ 2
- 2
consensus/reactor.go View File

@ -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 {
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 {
conR.Switch.MarkPeerAsGood(src)
}


Loading…
Cancel
Save