Browse Source

undo some megacheck suggestions

pull/561/head
Ethan Buchman 8 years ago
parent
commit
3c0128a680
5 changed files with 21 additions and 22 deletions
  1. +5
    -5
      blockchain/pool.go
  2. +1
    -2
      blockchain/reactor.go
  3. +10
    -10
      consensus/state.go
  4. +3
    -3
      p2p/connection.go
  5. +2
    -2
      state/execution.go

+ 5
- 5
blockchain/pool.go 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 {
// Bad peer?
// }
} 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
}*/
}
//-------------------------------------


+ 1
- 2
blockchain/reactor.go 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.


+ 10
- 10
consensus/state.go 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 {
// TODO: punish peer
//}
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 {
// we received +2/3 prevotes for a future round
// TODO: catchup event?
//}
} 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 {
// We just need to keep waiting.
//}
} else {
// We just need to keep waiting.
}
}
}


+ 3
- 3
p2p/connection.go View File

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


+ 2
- 2
state/execution.go 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


Loading…
Cancel
Save