aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/governance.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-09-18 09:07:52 +0800
committerGitHub <noreply@github.com>2018-09-18 09:07:52 +0800
commit81cf96477127a2da8843d544802027c7061a9c06 (patch)
tree70c06aec5df92df1dd93b605cc7afdbd2b8b0347 /simulation/governance.go
parent8a908e98279d7e80978cd412057eddd4a6bbf06c (diff)
downloadtangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.tar
tangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.tar.gz
tangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.tar.bz2
tangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.tar.lz
tangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.tar.xz
tangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.tar.zst
tangerine-consensus-81cf96477127a2da8843d544802027c7061a9c06.zip
core: remove ticker parameter from NewConsensus
- remove BlockProposingInterval, it's replaced by lambda. - remove ticker parameter of NewConsensus, ticker would be derived from governance. - leave a backdoor to hook the construction of ticker. - move 'Lambda' config from to consensus.
Diffstat (limited to 'simulation/governance.go')
-rw-r--r--simulation/governance.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/simulation/governance.go b/simulation/governance.go
index 44f679d..79c9119 100644
--- a/simulation/governance.go
+++ b/simulation/governance.go
@@ -20,6 +20,7 @@ package simulation
import (
"fmt"
"sync"
+ "time"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/dexon-foundation/dexon-consensus-core/simulation/config"
@@ -38,6 +39,7 @@ type simGovernance struct {
crs string
dkgComplaint map[uint64][]*types.DKGComplaint
dkgMasterPublicKey map[uint64][]*types.DKGMasterPublicKey
+ lambda time.Duration
}
// newSimGovernance returns a new simGovernance instance.
@@ -52,6 +54,7 @@ func newSimGovernance(
crs: consensusConfig.GenesisCRS,
dkgComplaint: make(map[uint64][]*types.DKGComplaint),
dkgMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey),
+ lambda: time.Duration(consensusConfig.Lambda) * time.Millisecond,
}
}
@@ -107,6 +110,11 @@ func (g *simGovernance) GetGenesisCRS() string {
return g.crs
}
+// GetLambda return lambda for BA.
+func (g *simGovernance) GetLambda() time.Duration {
+ return g.lambda
+}
+
// addValidator add a new validator into the simulated governance contract.
func (g *simGovernance) addValidator(vID types.ValidatorID) {
g.lock.Lock()