[consensus] rename SetViewID to SetViewIDs

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3347/head
Leo Chen 4 years ago
parent 54912716ce
commit 0c04a2b574
  1. 2
      cmd/harmony/main.go
  2. 6
      consensus/consensus_service.go
  3. 3
      consensus/consensus_v2.go

@ -600,7 +600,7 @@ func setupConsensusAndNode(hc harmonyConfig, nodeConfig *nodeconfig.ConfigType)
// Set the consensus ID to be the current block number
viewID := currentNode.Blockchain().CurrentBlock().Header().ViewID().Uint64()
currentConsensus.SetViewID(viewID + 1)
currentConsensus.SetViewIDs(viewID + 1)
utils.Logger().Info().
Uint64("viewID", viewID).
Msg("Init Blockchain")

@ -221,7 +221,7 @@ func (consensus *Consensus) checkViewID(msg *FBFTMessage) error {
//in syncing mode, node accepts incoming messages without viewID/leaderKey checking
//so only set mode to normal when new node enters consensus and need checking viewID
consensus.current.SetMode(Normal)
consensus.SetViewID(msg.ViewID)
consensus.SetViewIDs(msg.ViewID)
if len(msg.SenderPubkeys) != 1 {
return errors.New("Leader message can not have multiple sender keys")
}
@ -535,9 +535,9 @@ func (consensus *Consensus) addViewIDKeyIfNotExist(viewID uint64) {
}
}
// SetViewID set both current view ID and view changing ID to the height
// SetViewIDs set both current view ID and view changing ID to the height
// of the blockchain. It is used during client startup to recover the state
func (consensus *Consensus) SetViewID(height uint64) {
func (consensus *Consensus) SetViewIDs(height uint64) {
consensus.SetCurViewID(height)
consensus.SetViewChangingID(height)
}

@ -382,8 +382,7 @@ func (consensus *Consensus) Start(
case <-consensus.syncReadyChan:
consensus.getLogger().Info().Msg("[ConsensusMainLoop] syncReadyChan")
consensus.SetBlockNum(consensus.ChainReader.CurrentHeader().Number().Uint64() + 1)
consensus.SetCurViewID(consensus.ChainReader.CurrentHeader().ViewID().Uint64() + 1)
consensus.SetViewChangingID(consensus.ChainReader.CurrentHeader().ViewID().Uint64() + 1)
consensus.SetViewIDs(consensus.ChainReader.CurrentHeader().ViewID().Uint64() + 1)
mode := consensus.UpdateConsensusInformation()
consensus.current.SetMode(mode)
consensus.getLogger().Info().Str("Mode", mode.String()).Msg("Node is IN SYNC")

Loading…
Cancel
Save