From 0be7c830e4f96a7ae1a957c4bb12772447617076 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Tue, 4 Dec 2018 10:10:17 +0800 Subject: core: Fix stuffs (#354) - Add common.CustomLogger - CRS will wait for DKG to finish - Fix core.agreementMgr.processAgreementResult --- core/agreement-mgr.go | 4 ++-- core/consensus.go | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/agreement-mgr.go b/core/agreement-mgr.go index cbce6d2..57fb5c5 100644 --- a/core/agreement-mgr.go +++ b/core/agreement-mgr.go @@ -251,8 +251,8 @@ func (mgr *agreementMgr) processAgreementResult( nIDs := nodes.GetSubSet( int(mgr.gov.Configuration(result.Position.Round).NotarySetSize), types.NewNotarySetTarget(crs, result.Position.ChainID)) - for _, vote := range result.Votes { - agreement.processVote(&vote) + for key := range result.Votes { + agreement.processVote(&result.Votes[key]) } agreement.restart(nIDs, result.Position, crs) } diff --git a/core/consensus.go b/core/consensus.go index efd3ab7..a1aa072 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -611,6 +611,15 @@ func (con *Consensus) runCRS(round uint64) { 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.gov.IsDKGFinal(round) { + con.logger.Debug("DKG is not ready for running CRS. Retry later...", + "round", round) + time.Sleep(500 * time.Millisecond) + } + // Wait some time for DKG to recover private share. + time.Sleep(100 * time.Millisecond) // Start running next round CRS. con.logger.Debug("Calling Governance.CRS", "round", round) psig, err := con.cfgModule.preparePartialSignature(round, con.gov.CRS(round)) -- cgit v1.2.3