diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-12-18 16:51:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 16:51:29 +0800 |
commit | eaf271f8e4d16920d8575cf77c65ece2960444d0 (patch) | |
tree | f16137dc83613f306278141886a390de94f906a5 /core/agreement-mgr.go | |
parent | 9f240d93507cdf03935ba7e4e3a7b226f150736d (diff) | |
download | tangerine-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.gz tangerine-consensus-eaf271f8e4d16920d8575cf77c65ece2960444d0.tar.zst tangerine-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.go | 5 |
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 { |