aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-17 11:00:42 +0800
committerGitHub <noreply@github.com>2019-01-17 11:00:42 +0800
commitc5b303f4d143631fb565d4ec8ff3bcc609a4ffd3 (patch)
tree526b0805f0bef525007664cf712b165d42ff9f0b /core
parent48bf5a8d270fcac87aefb9366f29383b85745407 (diff)
downloadtangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.tar
tangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.tar.gz
tangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.tar.bz2
tangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.tar.lz
tangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.tar.xz
tangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.tar.zst
tangerine-consensus-c5b303f4d143631fb565d4ec8ff3bcc609a4ffd3.zip
core: Fix syncing BA issues (#421)
Diffstat (limited to 'core')
-rw-r--r--core/agreement-mgr.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/core/agreement-mgr.go b/core/agreement-mgr.go
index e468e9c..d3cf533 100644
--- a/core/agreement-mgr.go
+++ b/core/agreement-mgr.go
@@ -258,13 +258,20 @@ func (mgr *agreementMgr) processAgreementResult(
if isStop(aID) {
return nil
}
- if result.Position.Newer(&aID) {
+ if result.Position == aID {
mgr.logger.Info("Syncing BA", "position", &result.Position)
+ for key := range result.Votes {
+ if err := agreement.processVote(&result.Votes[key]); err != nil {
+ return err
+ }
+ }
+ } else if result.Position.Newer(&aID) {
+ mgr.logger.Info("Fast syncing BA", "position", &result.Position)
nodes, err := mgr.cache.GetNodeSet(result.Position.Round)
if err != nil {
return err
}
- mgr.logger.Debug("Calling Network.PullBlocks for syncing BA",
+ mgr.logger.Debug("Calling Network.PullBlocks for fast syncing BA",
"hash", result.BlockHash)
mgr.network.PullBlocks(common.Hashes{result.BlockHash})
mgr.logger.Debug("Calling Governance.CRS", "round", result.Position.Round)
@@ -459,16 +466,16 @@ Loop:
"round", recv.round(),
"chainID", setting.chainID)
err = nil
- nextHeight = oldPos.Height
+ nextHeight = restartPos.Height
}
- if isStop(oldPos) || nextHeight == 0 {
+ if isStop(restartPos) || nextHeight == 0 {
break
}
- if nextHeight > oldPos.Height {
+ if nextHeight > restartPos.Height {
break
}
mgr.logger.Debug("Lattice not ready!!!",
- "old", &oldPos, "next", nextHeight)
+ "old", &restartPos, "next", nextHeight)
time.Sleep(100 * time.Millisecond)
}
nextPos := types.Position{