From eaf271f8e4d16920d8575cf77c65ece2960444d0 Mon Sep 17 00:00:00 2001 From: Mission Liao Date: Tue, 18 Dec 2018 16:51:29 +0800 Subject: 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 --- core/dkg-tsig-protocol.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/dkg-tsig-protocol.go') diff --git a/core/dkg-tsig-protocol.go b/core/dkg-tsig-protocol.go index 8e03cbb..b120f81 100644 --- a/core/dkg-tsig-protocol.go +++ b/core/dkg-tsig-protocol.go @@ -26,6 +26,7 @@ import ( "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" "github.com/dexon-foundation/dexon-consensus/core/types" typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg" + "github.com/dexon-foundation/dexon-consensus/core/utils" ) // Errors for dkg module. @@ -491,7 +492,7 @@ func (tc *TSigVerifierCache) Update(round uint64) (bool, error) { gpk, err := NewDKGGroupPublicKey(round, tc.intf.DKGMasterPublicKeys(round), tc.intf.DKGComplaints(round), - int(tc.intf.Configuration(round).DKGSetSize/3)+1) + int(utils.GetConfigWithPanic(tc.intf, round, nil).DKGSetSize/3)+1) if err != nil { return false, err } -- cgit v1.2.3