aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-13 11:01:43 +0800
committerGitHub <noreply@github.com>2018-12-13 11:01:43 +0800
commit0ead4a7c012af9ddaa4a934729e216539d2caeb1 (patch)
tree1019c46011473db819a5715a6ef350f29432f342 /core
parent06693fc13b451835ac460688903c7abb660710fb (diff)
downloaddexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.tar
dexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.tar.gz
dexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.tar.bz2
dexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.tar.lz
dexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.tar.xz
dexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.tar.zst
dexon-consensus-0ead4a7c012af9ddaa4a934729e216539d2caeb1.zip
core: check if CRS is proposed before running CRS (#368)
Diffstat (limited to 'core')
-rw-r--r--core/consensus.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/core/consensus.go b/core/consensus.go
index fdd0fb8..a6d8037 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -630,15 +630,18 @@ func (con *Consensus) runDKG(round uint64, config *types.Config) {
}
func (con *Consensus) runCRS(round uint64) {
- con.logger.Debug("Calling Governance.CRS to check if already proposed",
- "round", round+1)
- if (con.gov.CRS(round+1) != common.Hash{}) {
- con.logger.Info("CRS already proposed", "round", round+1)
- return
- }
- con.logger.Debug("Calling Governance.IsDKGFinal to check if ready to run CRS",
- "round", round)
- for !con.cfgModule.isDKGReady(round) {
+ for {
+ con.logger.Debug("Calling Governance.CRS to check if already proposed",
+ "round", round+1)
+ if (con.gov.CRS(round+1) != common.Hash{}) {
+ con.logger.Info("CRS already proposed", "round", round+1)
+ return
+ }
+ con.logger.Debug("Calling Governance.IsDKGFinal to check if ready to run CRS",
+ "round", round)
+ if con.cfgModule.isDKGReady(round) {
+ break
+ }
con.logger.Debug("DKG is not ready for running CRS. Retry later...",
"round", round)
time.Sleep(500 * time.Millisecond)