undo some megacheck suggestions

This commit is contained in:
Ethan Buchman
2017-06-23 21:36:47 -04:00
parent 9c3eee0b00
commit 3c0128a680
5 changed files with 21 additions and 22 deletions

View File

@ -212,9 +212,9 @@ func (pool *BlockPool) AddBlock(peerID string, block *types.Block, blockSize int
pool.numPending--
peer := pool.peers[peerID]
peer.decrPending(blockSize)
} // else {
} else {
// Bad peer?
// }
}
}
// Sets the peer's alleged blockchain height.
@ -303,7 +303,7 @@ func (pool *BlockPool) sendTimeout(peerID string) {
}
// unused by tendermint; left for debugging purposes
/*func (pool *BlockPool) debug() string {
func (pool *BlockPool) debug() string {
pool.mtx.Lock() // Lock
defer pool.mtx.Unlock()
@ -317,7 +317,7 @@ func (pool *BlockPool) sendTimeout(peerID string) {
}
}
return str
}*/
}
//-------------------------------------

View File

@ -132,8 +132,7 @@ func (bcR *BlockchainReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
bcR.Logger.Debug("Receive", "src", src, "chID", chID, "msg", msg)
// [zr] note: the `megacheck` tool (go vet on steroids)
// really dislikes the logic in this switch
// TODO: improve logic to satisfy megacheck
switch msg := msg.(type) {
case *bcBlockRequestMessage:
// Got a request for a block. Respond with block if we have it.

View File

@ -649,9 +649,9 @@ func (cs *ConsensusState) handleMsg(mi msgInfo, rs RoundState) {
// attempt to add the vote and dupeout the validator if its a duplicate signature
// if the vote gives us a 2/3-any or 2/3-one, we transition
_ = cs.tryAddVote(msg.Vote, peerKey)
//if err == ErrAddingVote {
if err == ErrAddingVote {
// TODO: punish peer
//}
}
// NOTE: the vote is broadcast to peers by the reactor listening
// for vote events
@ -897,10 +897,10 @@ func (cs *ConsensusState) enterPrevote(height int, round int) {
// fire event for how we got here
if cs.isProposalComplete() {
types.FireEventCompleteProposal(cs.evsw, cs.RoundStateEvent())
} // else {
} else {
// we received +2/3 prevotes for a future round
// TODO: catchup event?
//}
}
cs.Logger.Info(cmn.Fmt("enterPrevote(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
@ -1122,9 +1122,9 @@ func (cs *ConsensusState) enterCommit(height int, commitRound int) {
// Set up ProposalBlockParts and keep waiting.
cs.ProposalBlock = nil
cs.ProposalBlockParts = types.NewPartSetFromHeader(blockID.PartsHeader)
} // else {
} else {
// We just need to keep waiting.
//}
}
}
}

View File

@ -366,9 +366,9 @@ func (c *MConnection) sendMsgPacket() bool {
// Nothing to send?
if leastChannel == nil {
return true
} // else {
} else {
// c.Logger.Info("Found a msgPacket to send")
//}
}
// Make & send a msgPacket from this channel
n, err := leastChannel.writeMsgPacketTo(c.bufWriter)

View File

@ -157,7 +157,7 @@ func updateValidators(validators *types.ValidatorSet, changedValidators []*abci.
// return a bit array of validators that signed the last commit
// NOTE: assumes commits have already been authenticated
/*func commitBitArrayFromBlock(block *types.Block) *cmn.BitArray {
func commitBitArrayFromBlock(block *types.Block) *cmn.BitArray {
signed := cmn.NewBitArray(len(block.LastCommit.Precommits))
for i, precommit := range block.LastCommit.Precommits {
if precommit != nil {
@ -165,7 +165,7 @@ func updateValidators(validators *types.ValidatorSet, changedValidators []*abci.
}
}
return signed
}*/
}
//-----------------------------------------------------
// Validate block