From c270381a9f991f9b5916fcf91841b5f19d865b5b Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Mon, 26 Oct 2020 11:24:14 -0700 Subject: [PATCH] Update viewchangingid; don't reset state in new view --- consensus/consensus_v2.go | 2 +- consensus/view_change.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 9cb7577c5..a2c07049d 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -517,7 +517,7 @@ func (consensus *Consensus) commitBlock(blk *types.Block, committedMsg *FBFTMess } atomic.AddUint64(&consensus.blockNum, 1) - consensus.SetCurBlockViewID(committedMsg.ViewID + 1) + consensus.SetViewIDs(committedMsg.ViewID + 1) consensus.LeaderPubKey = committedMsg.SenderPubkeys[0] // Update consensus keys at last so the change of leader status doesn't mess up normal flow if blk.IsLastBlockInEpoch() { diff --git a/consensus/view_change.go b/consensus/view_change.go index 75bad772c..632069821 100644 --- a/consensus/view_change.go +++ b/consensus/view_change.go @@ -316,7 +316,6 @@ func (consensus *Consensus) startNewView(viewID uint64, newLeaderPriKey *bls.Pri Str("myKey", newLeaderPriKey.Pub.Bytes.Hex()). Msg("[startNewView] viewChange stopped. I am the New Leader") - consensus.ResetState() consensus.LeaderPubKey = newLeaderPriKey.Pub return nil