diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index e1b39044c..aaee214a9 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -521,6 +521,10 @@ func (consensus *Consensus) commitBlock(blk *types.Block, committedMsg *FBFTMess atomic.AddUint64(&consensus.blockNum, 1) consensus.SetCurBlockViewID(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() { + consensus.SetMode(consensus.UpdateConsensusInformation()) + } consensus.ResetState() return nil } diff --git a/node/node_handler.go b/node/node_handler.go index 63749dcd0..037a667c1 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -395,10 +395,6 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block) error { // Broadcast client requested missing cross shard receipts if there is any node.BroadcastMissingCXReceipts() - // Update consensus keys at last so the change of leader status doesn't mess up normal flow - if newBlock.IsLastBlockInEpoch() { - node.Consensus.SetMode(node.Consensus.UpdateConsensusInformation()) - } if h := node.NodeConfig.WebHooks.Hooks; h != nil { if h.Availability != nil { for _, addr := range node.GetAddresses(newBlock.Epoch()) {