From a79c10ff1f4717e7e26096f81a57df10b8c9a592 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Wed, 26 Sep 2018 09:55:08 +0800 Subject: core: run TSIG for first configuration block at startup (#135) --- core/test/governance.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'core/test/governance.go') 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) -- cgit