From bc75a4687f2fae682b537444e716d3d8ca5392c1 Mon Sep 17 00:00:00 2001 From: Ganesha Upadhyaya Date: Mon, 23 Mar 2020 17:10:07 -0700 Subject: [PATCH] adding log to print out the current view id adding additional check to make sure that current view id is not zero reset the current.viewID to block height --- consensus/checks.go | 4 ++-- consensus/consensus_service.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/consensus/checks.go b/consensus/checks.go index a90cae924..551838ce0 100644 --- a/consensus/checks.go +++ b/consensus/checks.go @@ -242,8 +242,8 @@ func (consensus *Consensus) onViewChangeSanityCheck(recvMsg *FBFTMessage) bool { if recvMsg.ViewID-consensus.current.ViewID() > MaxViewIDDiff { consensus.getLogger().Debug(). Uint64("MsgViewID", recvMsg.ViewID). - Uint64("MaxViewIDDiff", MaxViewIDDiff). - Msg("Received viewID that is MaxViewIDDiff further from the current viewID!") + Uint64("CurrentViewID", consensus.current.ViewID()). + Msg("Received viewID that is MaxViewIDDiff (100) further from the current viewID!") return false } return true diff --git a/consensus/consensus_service.go b/consensus/consensus_service.go index 7a50ff399..5c4c7a9f0 100644 --- a/consensus/consensus_service.go +++ b/consensus/consensus_service.go @@ -278,6 +278,7 @@ func (consensus *Consensus) verifyViewChangeSenderKey(msg *msg_pb.Message) (*bls // SetViewID set the viewID to the height of the blockchain func (consensus *Consensus) SetViewID(height uint64) { consensus.viewID = height + consensus.current.viewID = height } // SetMode sets the mode of consensus