mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-28 12:11:44 +00:00
undo some megacheck suggestions
This commit is contained in:
@ -212,9 +212,9 @@ func (pool *BlockPool) AddBlock(peerID string, block *types.Block, blockSize int
|
|||||||
pool.numPending--
|
pool.numPending--
|
||||||
peer := pool.peers[peerID]
|
peer := pool.peers[peerID]
|
||||||
peer.decrPending(blockSize)
|
peer.decrPending(blockSize)
|
||||||
} // else {
|
} else {
|
||||||
// Bad peer?
|
// Bad peer?
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the peer's alleged blockchain height.
|
// Sets the peer's alleged blockchain height.
|
||||||
@ -303,7 +303,7 @@ func (pool *BlockPool) sendTimeout(peerID string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unused by tendermint; left for debugging purposes
|
// unused by tendermint; left for debugging purposes
|
||||||
/*func (pool *BlockPool) debug() string {
|
func (pool *BlockPool) debug() string {
|
||||||
pool.mtx.Lock() // Lock
|
pool.mtx.Lock() // Lock
|
||||||
defer pool.mtx.Unlock()
|
defer pool.mtx.Unlock()
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ func (pool *BlockPool) sendTimeout(peerID string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str
|
return str
|
||||||
}*/
|
}
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
|
@ -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)
|
bcR.Logger.Debug("Receive", "src", src, "chID", chID, "msg", msg)
|
||||||
|
|
||||||
// [zr] note: the `megacheck` tool (go vet on steroids)
|
// TODO: improve logic to satisfy megacheck
|
||||||
// really dislikes the logic in this switch
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *bcBlockRequestMessage:
|
case *bcBlockRequestMessage:
|
||||||
// Got a request for a block. Respond with block if we have it.
|
// Got a request for a block. Respond with block if we have it.
|
||||||
|
@ -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
|
// 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
|
// if the vote gives us a 2/3-any or 2/3-one, we transition
|
||||||
_ = cs.tryAddVote(msg.Vote, peerKey)
|
_ = cs.tryAddVote(msg.Vote, peerKey)
|
||||||
//if err == ErrAddingVote {
|
if err == ErrAddingVote {
|
||||||
// TODO: punish peer
|
// TODO: punish peer
|
||||||
//}
|
}
|
||||||
|
|
||||||
// NOTE: the vote is broadcast to peers by the reactor listening
|
// NOTE: the vote is broadcast to peers by the reactor listening
|
||||||
// for vote events
|
// for vote events
|
||||||
@ -897,10 +897,10 @@ func (cs *ConsensusState) enterPrevote(height int, round int) {
|
|||||||
// fire event for how we got here
|
// fire event for how we got here
|
||||||
if cs.isProposalComplete() {
|
if cs.isProposalComplete() {
|
||||||
types.FireEventCompleteProposal(cs.evsw, cs.RoundStateEvent())
|
types.FireEventCompleteProposal(cs.evsw, cs.RoundStateEvent())
|
||||||
} // else {
|
} else {
|
||||||
// we received +2/3 prevotes for a future round
|
// we received +2/3 prevotes for a future round
|
||||||
// TODO: catchup event?
|
// TODO: catchup event?
|
||||||
//}
|
}
|
||||||
|
|
||||||
cs.Logger.Info(cmn.Fmt("enterPrevote(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
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.
|
// Set up ProposalBlockParts and keep waiting.
|
||||||
cs.ProposalBlock = nil
|
cs.ProposalBlock = nil
|
||||||
cs.ProposalBlockParts = types.NewPartSetFromHeader(blockID.PartsHeader)
|
cs.ProposalBlockParts = types.NewPartSetFromHeader(blockID.PartsHeader)
|
||||||
} // else {
|
} else {
|
||||||
// We just need to keep waiting.
|
// We just need to keep waiting.
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,9 +366,9 @@ func (c *MConnection) sendMsgPacket() bool {
|
|||||||
// Nothing to send?
|
// Nothing to send?
|
||||||
if leastChannel == nil {
|
if leastChannel == nil {
|
||||||
return true
|
return true
|
||||||
} // else {
|
} else {
|
||||||
// c.Logger.Info("Found a msgPacket to send")
|
// c.Logger.Info("Found a msgPacket to send")
|
||||||
//}
|
}
|
||||||
|
|
||||||
// Make & send a msgPacket from this channel
|
// Make & send a msgPacket from this channel
|
||||||
n, err := leastChannel.writeMsgPacketTo(c.bufWriter)
|
n, err := leastChannel.writeMsgPacketTo(c.bufWriter)
|
||||||
|
@ -157,7 +157,7 @@ func updateValidators(validators *types.ValidatorSet, changedValidators []*abci.
|
|||||||
|
|
||||||
// return a bit array of validators that signed the last commit
|
// return a bit array of validators that signed the last commit
|
||||||
// NOTE: assumes commits have already been authenticated
|
// 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))
|
signed := cmn.NewBitArray(len(block.LastCommit.Precommits))
|
||||||
for i, precommit := range block.LastCommit.Precommits {
|
for i, precommit := range block.LastCommit.Precommits {
|
||||||
if precommit != nil {
|
if precommit != nil {
|
||||||
@ -165,7 +165,7 @@ func updateValidators(validators *types.ValidatorSet, changedValidators []*abci.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return signed
|
return signed
|
||||||
}*/
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// Validate block
|
// Validate block
|
||||||
|
Reference in New Issue
Block a user