aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-04-16 18:41:00 +0800
committerGitHub <noreply@github.com>2019-04-16 18:41:00 +0800
commit1719b6f97213b4b9a7a2bb1804713b584c312106 (patch)
tree2897b1128a6aa2381e6fdf75505e432b91b4db7e
parentacf1dee69e239b65837d2c602801b41dd7658e6d (diff)
downloaddexon-1719b6f97213b4b9a7a2bb1804713b584c312106.tar.gz
dexon-1719b6f97213b4b9a7a2bb1804713b584c312106.tar.zst
dexon-1719b6f97213b4b9a7a2bb1804713b584c312106.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 1fa66cefb..2d4f27e99 100644
--- a/core/vm/oracle_contracts.go
+++ b/core/vm/oracle_contracts.go
@@ -2044,6 +2044,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.