diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-11-14 16:06:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-14 16:06:35 +0800 |
commit | 07ca4b1c5b0c193d621d5fc62f10a4eb083ced39 (patch) | |
tree | d6d5d1561fc827192f335d90f44961b532702d25 | |
parent | 3a04c0d3405960e3a6eabb6adc700fa2fd5aac21 (diff) | |
download | dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.gz dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.bz2 dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.lz dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.xz dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.zst dexon-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.zip |
core: Fix syncing issues (#326)
* BA should not start if governance is out-of-sync
* Should not do sync BA if consensus is not started
-rw-r--r-- | core/consensus.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/consensus.go b/core/consensus.go index 99cb7c1..931b2db 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -494,6 +494,12 @@ BALoop: select { case newNotary := <-recv.restartNotary: if newNotary { + con.logger.Debug("Calling Governance.CRS", "round", recv.round) + crs = con.gov.CRS(recv.round) + if (crs == common.Hash{}) { + // Governance is out-of-sync. + continue BALoop + } configForNewRound := con.gov.Configuration(recv.round) recv.changeNotaryTime = recv.changeNotaryTime.Add(configForNewRound.RoundInterval) @@ -501,8 +507,6 @@ BALoop: if err != nil { panic(err) } - con.logger.Debug("Calling Governance.CRS", "round", recv.round) - crs = con.gov.CRS(recv.round) con.logger.Debug("Calling Governance.Configuration", "round", recv.round) nIDs = nodes.GetSubSet( @@ -879,6 +883,9 @@ func (con *Consensus) ProcessAgreementResult( // Syncing BA Module. agreement := con.baModules[rand.Position.ChainID] aID := agreement.agreementID() + if isStop(aID) { + return nil + } if rand.Position.Newer(&aID) { con.logger.Info("Syncing BA", "position", &rand.Position) nodes, err := con.nodeSetCache.GetNodeSet(rand.Position.Round) |