aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
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 /core/test
parent0ffea9dadcfc0d8a740942a2d666eccc00613cd4 (diff)
downloaddexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar
dexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.gz
dexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.bz2
dexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.lz
dexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.xz
dexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.tar.zst
dexon-consensus-a79c10ff1f4717e7e26096f81a57df10b8c9a592.zip
core: run TSIG for first configuration block at startup (#135)
Diffstat (limited to 'core/test')
-rw-r--r--core/test/governance.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/test/governance.go b/core/test/governance.go
index 0bcb39a..1225b4a 100644
--- a/core/test/governance.go
+++ b/core/test/governance.go
@@ -38,6 +38,7 @@ type Governance struct {
lambdaDKG time.Duration
notarySet map[types.NodeID]struct{}
privateKeys map[types.NodeID]crypto.PrivateKey
+ tsig map[uint64]crypto.Signature
DKGComplaint map[uint64][]*types.DKGComplaint
DKGMasterPublicKey map[uint64][]*types.DKGMasterPublicKey
}
@@ -50,6 +51,7 @@ func NewGovernance(nodeCount int, lambda time.Duration) (
lambdaDKG: lambda * 10,
notarySet: make(map[types.NodeID]struct{}),
privateKeys: make(map[types.NodeID]crypto.PrivateKey),
+ tsig: make(map[uint64]crypto.Signature),
DKGComplaint: make(map[uint64][]*types.DKGComplaint),
DKGMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey),
}
@@ -103,6 +105,19 @@ func (g *Governance) GetPrivateKey(
return
}
+// ProposeThresholdSignature porposes a ThresholdSignature of round.
+func (g *Governance) ProposeThresholdSignature(
+ round uint64, signature crypto.Signature) {
+ g.tsig[round] = signature
+}
+
+// GetThresholdSignature gets a ThresholdSignature of round.
+func (g *Governance) GetThresholdSignature(round uint64) (
+ sig crypto.Signature, exist bool) {
+ sig, exist = g.tsig[round]
+ return
+}
+
// AddDKGComplaint add a DKGComplaint.
func (g *Governance) AddDKGComplaint(complaint *types.DKGComplaint) {
g.DKGComplaint[complaint.Round] = append(g.DKGComplaint[complaint.Round], complaint)