aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/governance.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-09-26 09:55:08 +0800
committerGitHub <noreply@github.com>2018-09-26 09:55:08 +0800
commita79c10ff1f4717e7e26096f81a57df10b8c9a592 (patch)
tree69081c65669f0a68e7f27a81efffbacfb1983f10 /simulation/governance.go
parent0ffea9dadcfc0d8a740942a2d666eccc00613cd4 (diff)
downloadtangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar
tangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.gz
tangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.bz2
tangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.lz
tangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.xz
tangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.zst
tangerine-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.zip
core: run TSIG for first configuration block at startup (#135)
Diffstat (limited to 'simulation/governance.go')
-rw-r--r--simulation/governance.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/simulation/governance.go b/simulation/governance.go
index 643c181..133276c 100644
--- a/simulation/governance.go
+++ b/simulation/governance.go
@@ -23,6 +23,7 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
+ "github.com/dexon-foundation/dexon-consensus-core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/simulation/config"
)
@@ -37,6 +38,7 @@ type simGovernance struct {
phiRatio float32
chainNum uint32
crs []byte
+ tsig map[uint64]crypto.Signature
dkgComplaint map[uint64][]*types.DKGComplaint
dkgMasterPublicKey map[uint64][]*types.DKGMasterPublicKey
lambdaBA time.Duration
@@ -56,6 +58,7 @@ func newSimGovernance(
phiRatio: consensusConfig.PhiRatio,
chainNum: consensusConfig.ChainNum,
crs: []byte(consensusConfig.GenesisCRS),
+ tsig: make(map[uint64]crypto.Signature),
dkgComplaint: make(map[uint64][]*types.DKGComplaint),
dkgMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey),
lambdaBA: time.Duration(consensusConfig.LambdaBA) * time.Millisecond,
@@ -108,6 +111,19 @@ func (g *simGovernance) addNode(nID types.NodeID) {
g.notarySet[nID] = struct{}{}
}
+// ProposeThresholdSignature porposes a ThresholdSignature of round.
+func (g *simGovernance) ProposeThresholdSignature(
+ round uint64, signature crypto.Signature) {
+ g.tsig[round] = signature
+}
+
+// GetThresholdSignature gets a ThresholdSignature of round.
+func (g *simGovernance) GetThresholdSignature(round uint64) (
+ sig crypto.Signature, exist bool) {
+ sig, exist = g.tsig[round]
+ return
+}
+
// AddDKGComplaint adds a DKGComplaint.
func (g *simGovernance) AddDKGComplaint(complaint *types.DKGComplaint) {
// TODO(jimmy-dexon): check if the input is valid.