Fix usage of private methods.

pull/4509/head
frozen 2 years ago committed by Casey Gardiner
parent 18cbe84ef6
commit eb6c946fe1
  1. 4
      consensus/consensus_service.go
  2. 10
      consensus/consensus_v2.go

@ -248,9 +248,9 @@ func (consensus *Consensus) checkViewID(msg *FBFTMessage) error {
Str("leaderKey", consensus.LeaderPubKey.Bytes.Hex()).
Msg("[checkViewID] Start consensus timer")
return nil
} else if msg.ViewID > consensus.GetCurBlockViewID() {
} else if msg.ViewID > consensus.getCurBlockViewID() {
return consensus_engine.ErrViewIDNotMatch
} else if msg.ViewID < consensus.GetCurBlockViewID() {
} else if msg.ViewID < consensus.getCurBlockViewID() {
return errors.New("view ID belongs to the past")
}
return nil

@ -144,7 +144,7 @@ func (consensus *Consensus) finalCommit() {
consensus.getLogger().Info().
Int64("NumCommits", numCommits).
Msg("[finalCommit] Finalizing Consensus")
beforeCatchupNum := consensus.BlockNum()
beforeCatchupNum := consensus.getBlockNum()
leaderPriKey, err := consensus.getConsensusLeaderPrivateKey()
if err != nil {
@ -345,16 +345,16 @@ func (consensus *Consensus) StartChannel() {
func (consensus *Consensus) syncReadyChan() {
consensus.getLogger().Info().Msg("[ConsensusMainLoop] syncReadyChan")
if consensus.BlockNum() < consensus.Blockchain().CurrentHeader().Number().Uint64()+1 {
consensus.SetBlockNum(consensus.Blockchain().CurrentHeader().Number().Uint64() + 1)
consensus.SetViewIDs(consensus.Blockchain().CurrentHeader().ViewID().Uint64() + 1)
if consensus.getBlockNum() < consensus.Blockchain().CurrentHeader().Number().Uint64()+1 {
consensus.setBlockNum(consensus.Blockchain().CurrentHeader().Number().Uint64() + 1)
consensus.setViewIDs(consensus.Blockchain().CurrentHeader().ViewID().Uint64() + 1)
mode := consensus.updateConsensusInformation()
consensus.current.SetMode(mode)
consensus.getLogger().Info().Msg("[syncReadyChan] Start consensus timer")
consensus.consensusTimeout[timeoutConsensus].Start()
consensus.getLogger().Info().Str("Mode", mode.String()).Msg("Node is IN SYNC")
consensusSyncCounterVec.With(prometheus.Labels{"consensus": "in_sync"}).Inc()
} else if consensus.Mode() == Syncing {
} else if consensus.mode() == Syncing {
// Corner case where sync is triggered before `onCommitted` and there is a race
// for block insertion between consensus and downloader.
mode := consensus.updateConsensusInformation()

Loading…
Cancel
Save