aboutsummaryrefslogtreecommitdiffstats
path: root/core/agreement-mgr.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-12-18 16:51:29 +0800
committerGitHub <noreply@github.com>2018-12-18 16:51:29 +0800
commiteaf271f8e4d16920d8575cf77c65ece2960444d0 (patch)
treef16137dc83613f306278141886a390de94f906a5 /core/agreement-mgr.go
parent9f240d93507cdf03935ba7e4e3a7b226f150736d (diff)
downloaddexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar
dexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.gz
dexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.bz2
dexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.lz
dexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.xz
dexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.zst
dexon-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.zip
misc: panic not ready (#374)
* Panic when config/crs not ready For those calls to Governace.Configuration and Governance.CRS without checking returns, replace those calls with these newly added helpers: - utils.GetConfigurationWithPanic - utils.GetCRSWithPanic They would check returns, and panic directly if not ready yet. * Fix a bug that config is not ready when syncing
Diffstat (limited to 'core/agreement-mgr.go')
-rw-r--r--core/agreement-mgr.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/agreement-mgr.go b/core/agreement-mgr.go
index 4cb47b1..fb65364 100644
--- a/core/agreement-mgr.go
+++ b/core/agreement-mgr.go
@@ -248,9 +248,10 @@ func (mgr *agreementMgr) processAgreementResult(
"hash", result.BlockHash)
mgr.network.PullBlocks(common.Hashes{result.BlockHash})
mgr.logger.Debug("Calling Governance.CRS", "round", result.Position.Round)
- crs := mgr.gov.CRS(result.Position.Round)
+ crs := utils.GetCRSWithPanic(mgr.gov, result.Position.Round, mgr.logger)
nIDs := nodes.GetSubSet(
- int(mgr.gov.Configuration(result.Position.Round).NotarySetSize),
+ int(utils.GetConfigWithPanic(
+ mgr.gov, result.Position.Round, mgr.logger).NotarySetSize),
types.NewNotarySetTarget(crs, result.Position.ChainID))
for key := range result.Votes {
if err := agreement.processVote(&result.Votes[key]); err != nil {