aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-11-14 16:06:35 +0800
committerGitHub <noreply@github.com>2018-11-14 16:06:35 +0800
commit07ca4b1c5b0c193d621d5fc62f10a4eb083ced39 (patch)
treed6d5d1561fc827192f335d90f44961b532702d25
parent3a04c0d3405960e3a6eabb6adc700fa2fd5aac21 (diff)
downloadtangerine-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar
tangerine-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.gz
tangerine-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.bz2
tangerine-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.lz
tangerine-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.xz
tangerine-consensus-07ca4b1c5b0c193d621d5fc62f10a4eb083ced39.tar.zst
tangerine-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.go11
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)