[consensus] move UpdateConsensusInformation from onConsensusDone to commitBlock

pull/3400/head
Jacky Wang 4 years ago
parent a707777be8
commit b238d71e16
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 4
      consensus/consensus_v2.go
  2. 4
      node/node_handler.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
}

@ -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()) {

Loading…
Cancel
Save