add view change timeout debug info

pull/956/head
chao 5 years ago committed by chaosma
parent 7dc85192e0
commit c5592efeb8
  1. 15
      consensus/consensus_v2.go
  2. 2
      consensus/view_change.go

@ -520,8 +520,13 @@ func (consensus *Consensus) finalizeCommits() {
consensus.viewID++
consensus.blockNum++
if consensus.consensusTimeout[timeoutBootstrap].IsActive() {
consensus.consensusTimeout[timeoutBootstrap].Stop()
utils.GetLogger().Debug("start consensus timeout; stop bootstrap timeout only once", "viewID", consensus.viewID, "block", consensus.blockNum)
} else {
utils.GetLogger().Debug("start consensus timeout", "viewID", consensus.viewID, "block", consensus.blockNum)
}
consensus.consensusTimeout[timeoutConsensus].Start()
consensus.consensusTimeout[timeoutBootstrap].Stop()
consensus.OnConsensusDone(&blockObj)
utils.GetLogInstance().Debug("HOORAY!!!!!!! CONSENSUS REACHED!!!!!!!", "viewID", consensus.viewID, "numOfSignatures", len(consensus.commitSigs))
@ -600,8 +605,13 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) {
consensus.commitBitmap = mask
consensus.tryCatchup()
if consensus.consensusTimeout[timeoutBootstrap].IsActive() {
consensus.consensusTimeout[timeoutBootstrap].Stop()
utils.GetLogger().Debug("start consensus timeout; stop bootstrap timeout only once", "viewID", consensus.viewID, "block", consensus.blockNum)
} else {
utils.GetLogger().Debug("start consensus timeout", "viewID", consensus.viewID, "block", consensus.blockNum)
}
consensus.consensusTimeout[timeoutConsensus].Start()
consensus.consensusTimeout[timeoutBootstrap].Stop()
return
}
@ -704,6 +714,7 @@ func (consensus *Consensus) Start(blockChannel chan *types.Block, stopChan chan
defer close(stoppedChan)
ticker := time.NewTicker(3 * time.Second)
consensus.consensusTimeout[timeoutBootstrap].Start()
utils.GetLogger().Debug("start bootstrap timeout only once", "viewID", consensus.viewID, "block", consensus.blockNum)
for {
select {
case <-ticker.C:

@ -155,6 +155,7 @@ func (consensus *Consensus) startViewChange(viewID uint32) {
consensus.consensusTimeout[timeoutViewChange].SetDuration(duration)
consensus.consensusTimeout[timeoutViewChange].Start()
utils.GetLogger().Debug("start view change timeout", "viewID", consensus.viewID, "block", consensus.blockNum, "viewChangingID", consensus.mode.ViewID())
}
// new leader send new view message
@ -330,6 +331,7 @@ func (consensus *Consensus) onViewChange(msg *msg_pb.Message) {
consensus.ResetViewChangeState()
consensus.consensusTimeout[timeoutViewChange].Stop()
consensus.consensusTimeout[timeoutConsensus].Start()
utils.GetLogger().Debug("start consensus timeout and stop view change timeout", "viewID", consensus.viewID, "block", consensus.blockNum, "viewChangingID", consensus.mode.ViewID())
}
utils.GetLogInstance().Debug("onViewChange", "numSigs", len(consensus.viewIDSigs), "needed", consensus.Quorum())
}

Loading…
Cancel
Save