aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-04-16 18:41:00 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-15 22:09:56 +0800
commit82f1f1a5566d1870466b25545986b7c00fff105d (patch)
tree998220b484ee137d651e2ecbd9dd74509e5f2203
parent3cdeb14464559489d58d911ee0d2dff8b5341378 (diff)
downloadgo-tangerine-82f1f1a5566d1870466b25545986b7c00fff105d.tar.gz
go-tangerine-82f1f1a5566d1870466b25545986b7c00fff105d.tar.zst
go-tangerine-82f1f1a5566d1870466b25545986b7c00fff105d.zip
core: vm: clearDKG in resetDKG (#368)
-rw-r--r--core/vm/oracle_contracts.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go
index 9adf98e53..4a93c9805 100644
--- a/core/vm/oracle_contracts.go
+++ b/core/vm/oracle_contracts.go
@@ -2042,6 +2042,14 @@ func (g *GovernanceContract) resetDKG(newSignedCRS []byte) ([]byte, error) {
round := g.evm.Round
nextRound := new(big.Int).Add(round, big.NewInt(1))
+ // If no one call addDKGMasterPublicKey, DKG of previous round will not be
+ // cleared.
+ if g.state.DKGRound().Cmp(round) == 0 {
+ // Clear DKG states for next round.
+ g.clearDKG()
+ g.state.SetDKGRound(nextRound)
+ }
+
resetCount := g.state.DKGResetCount(nextRound)
// Just restart DEXON if failed at round 0.