aboutsummaryrefslogtreecommitdiffstats
path: root/core/governance.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-21 12:03:28 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-21 12:03:28 +0800
commite27667c7563e71adc766fb1155c340cca91f33e0 (patch)
tree1aa53d92d11ebff368bce03d703cf32dc3e0dc19 /core/governance.go
parent63c34273c8264456bd9849e8f5b987f7da27816e (diff)
downloaddexon-e27667c7563e71adc766fb1155c340cca91f33e0.tar
dexon-e27667c7563e71adc766fb1155c340cca91f33e0.tar.gz
dexon-e27667c7563e71adc766fb1155c340cca91f33e0.tar.bz2
dexon-e27667c7563e71adc766fb1155c340cca91f33e0.tar.lz
dexon-e27667c7563e71adc766fb1155c340cca91f33e0.tar.xz
dexon-e27667c7563e71adc766fb1155c340cca91f33e0.tar.zst
dexon-e27667c7563e71adc766fb1155c340cca91f33e0.zip
core: vm: Add `MPKReady` to governance (#97)
* core/vm: Add DKGMPKReady * param: update GenesisHash * vendor: sync to latest core
Diffstat (limited to 'core/governance.go')
-rw-r--r--core/governance.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/governance.go b/core/governance.go
index ea0036a0e..45594fb64 100644
--- a/core/governance.go
+++ b/core/governance.go
@@ -121,6 +121,14 @@ func (g *Governance) DKGMasterPublicKeys(round uint64) []*dkgTypes.MasterPublicK
return headHelper.UniqueDKGMasterPublicKeys(big.NewInt(int64(round)))
}
+func (g *Governance) IsDKGMPKReady(round uint64) bool {
+ headHelper := g.GetHeadHelper()
+ config := g.Configuration(round)
+ threshold := 2*uint64(config.DKGSetSize)/3 + 1
+ count := headHelper.DKGMPKReadysCount(big.NewInt(int64(round))).Uint64()
+ return count >= threshold
+}
+
func (g *Governance) IsDKGFinal(round uint64) bool {
headHelper := g.GetHeadHelper()
config := g.Configuration(round)