aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/governance.go
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 /simulation/governance.go
parent9267d50de25ddf0f280eee797e2030ea989294e4 (diff)
downloadtangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar
tangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.gz
tangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.bz2
tangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.lz
tangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.xz
tangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.tar.zst
tangerine-consensus-db07d005e2e5a9208620a8d0e5fcaedeaa6ed644.zip
core: Add round to DKG methods in gov. Change network interface name (#185)
Diffstat (limited to 'simulation/governance.go')
-rw-r--r--simulation/governance.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/simulation/governance.go b/simulation/governance.go
index f22abce..2b0f56b 100644
--- a/simulation/governance.go
+++ b/simulation/governance.go
@@ -140,7 +140,11 @@ func (g *simGovernance) addNode(pubKey crypto.PublicKey) {
}
// AddDKGComplaint adds a DKGComplaint.
-func (g *simGovernance) AddDKGComplaint(complaint *types.DKGComplaint) {
+func (g *simGovernance) AddDKGComplaint(
+ round uint64, complaint *types.DKGComplaint) {
+ if round != complaint.Round {
+ return
+ }
if g.IsDKGFinal(complaint.Round) {
return
}
@@ -166,7 +170,10 @@ func (g *simGovernance) DKGComplaints(round uint64) []*types.DKGComplaint {
// AddDKGMasterPublicKey adds a DKGMasterPublicKey.
func (g *simGovernance) AddDKGMasterPublicKey(
- masterPublicKey *types.DKGMasterPublicKey) {
+ round uint64, masterPublicKey *types.DKGMasterPublicKey) {
+ if round != masterPublicKey.Round {
+ return
+ }
// TODO(jimmy-dexon): check if the input is valid.
g.dkgMasterPublicKey[masterPublicKey.Round] = append(
g.dkgMasterPublicKey[masterPublicKey.Round], masterPublicKey)
@@ -186,7 +193,11 @@ func (g *simGovernance) DKGMasterPublicKeys(
}
// AddDKGFinalize adds a DKG finalize message.
-func (g *simGovernance) AddDKGFinalize(final *types.DKGFinalize) {
+func (g *simGovernance) AddDKGFinalize(
+ round uint64, final *types.DKGFinalize) {
+ if round != final.Round {
+ return
+ }
// TODO(jimmy-dexon): check if the input is valid.
if _, exist := g.dkgFinal[final.Round]; !exist {
g.dkgFinal[final.Round] = make(map[types.NodeID]struct{})