aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-09 11:59:19 +0800
committerGitHub <noreply@github.com>2018-10-09 11:59:19 +0800
commitdb07d005e2e5a9208620a8d0e5fcaedeaa6ed644 (patch)
tree860c7a1c2f5d30296f66b07ed4e59117eb265eb7 /core/test
parent9267d50de25ddf0f280eee797e2030ea989294e4 (diff)
downloaddexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar
dexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.gz
dexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.bz2
dexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.lz
dexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.xz
dexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.zst
dexon-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.zip
core: Add round to DKG methods in gov. Change network interface name (#185)
Diffstat (limited to 'core/test')
-rw-r--r--core/test/governance.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/test/governance.go b/core/test/governance.go
index de3f34b..de0ec21 100644
--- a/core/test/governance.go
+++ b/core/test/governance.go
@@ -136,7 +136,11 @@ func (g *Governance) PrivateKeys() (keys []crypto.PrivateKey) {
}
// AddDKGComplaint add a DKGComplaint.
-func (g *Governance) AddDKGComplaint(complaint *types.DKGComplaint) {
+func (g *Governance) AddDKGComplaint(
+ round uint64, complaint *types.DKGComplaint) {
+ if round != complaint.Round {
+ return
+ }
if g.IsDKGFinal(complaint.Round) {
return
}
@@ -167,7 +171,10 @@ func (g *Governance) DKGComplaints(round uint64) []*types.DKGComplaint {
// AddDKGMasterPublicKey adds a DKGMasterPublicKey.
func (g *Governance) AddDKGMasterPublicKey(
- masterPublicKey *types.DKGMasterPublicKey) {
+ round uint64, masterPublicKey *types.DKGMasterPublicKey) {
+ if round != masterPublicKey.Round {
+ return
+ }
g.lock.Lock()
defer g.lock.Unlock()
g.DKGMasterPublicKey[masterPublicKey.Round] = append(
@@ -194,7 +201,10 @@ func (g *Governance) DKGMasterPublicKeys(
}
// AddDKGFinalize adds a DKG finalize message.
-func (g *Governance) AddDKGFinalize(final *types.DKGFinalize) {
+func (g *Governance) AddDKGFinalize(round uint64, final *types.DKGFinalize) {
+ if round != final.Round {
+ return
+ }
g.lock.Lock()
defer g.lock.Unlock()
if _, exist := g.DKGFinal[final.Round]; !exist {