aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-08 21:01:33 +0800
committerJimmy Hu <jimmy.hu@dexon.org>2018-10-08 21:01:33 +0800
commit8944f1ea16c531cbccc3f01d91854e942e040871 (patch)
tree26c1e693771d395cef5499db22ad2cadba29f79e /core/consensus.go
parent910fd2621b4110c2747561ef38c84413dd9ce117 (diff)
downloaddexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.tar
dexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.tar.gz
dexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.tar.bz2
dexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.tar.lz
dexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.tar.xz
dexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.tar.zst
dexon-consensus-8944f1ea16c531cbccc3f01d91854e942e040871.zip
core: update config variable name grammar and remove configuration (#184)
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/consensus.go b/core/consensus.go
index 3b8883e..dc1e3d4 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -259,7 +259,7 @@ func NewConsensus(
gov)
// Register DKG for the initial round. This is a temporary function call for
// simulation.
- cfgModule.registerDKG(0, config.NumDKGSet/3)
+ cfgModule.registerDKG(0, int(config.DKGSetSize)/3)
// Construct Consensus instance.
con := &Consensus{
ID: ID,
@@ -362,7 +362,8 @@ BALoop:
if err != nil {
panic(err)
}
- nIDs = nodes.GetSubSet(con.gov.Configuration(con.round).NumNotarySet,
+ nIDs = nodes.GetSubSet(
+ int(con.gov.Configuration(con.round).NotarySetSize),
types.NewNotarySetTarget(con.gov.CRS(con.round), chainID))
}
agreement.restart(nIDs, con.lattice.NextPosition(chainID))
@@ -465,7 +466,8 @@ func (con *Consensus) initialRound(startTime time.Time) {
})
con.event.RegisterTime(startTime.Add(con.currentConfig.RoundInterval/2),
func(time.Time) {
- con.cfgModule.registerDKG(con.round+1, con.currentConfig.NumDKGSet/3)
+ con.cfgModule.registerDKG(
+ con.round+1, int(con.currentConfig.DKGSetSize/3))
})
con.event.RegisterTime(startTime.Add(con.currentConfig.RoundInterval),
func(time.Time) {
@@ -555,7 +557,7 @@ func (con *Consensus) ProcessAgreementResult(
if _, exist := dkgSet[con.ID]; !exist {
return nil
}
- if len(rand.Votes) <= con.currentConfig.NumNotarySet/3*2 {
+ if len(rand.Votes) <= int(con.currentConfig.NotarySetSize/3*2) {
return ErrNotEnoughVotes
}
if rand.Position.ChainID >= con.currentConfig.NumChains {
@@ -622,7 +624,7 @@ func (con *Consensus) ProcessBlockRandomnessResult(
gpk, err := NewDKGGroupPublicKey(round,
con.gov.DKGMasterPublicKeys(round),
con.gov.DKGComplaints(round),
- con.gov.Configuration(round).NumDKGSet/3)
+ int(con.gov.Configuration(round).DKGSetSize/3))
if err != nil {
return err
}