aboutsummaryrefslogtreecommitdiffstats
path: root/core/governance.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-27 20:47:32 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:59 +0800
commit0c63646ca8b06bb527737cd6e2a7fe58f169efff (patch)
treeb0666613c2a3cb84d53b60597bfef5ec45548c3a /core/governance.go
parent91981becf98b988470810aa1c26d86de2d294e29 (diff)
downloaddexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.tar
dexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.tar.gz
dexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.tar.bz2
dexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.tar.lz
dexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.tar.xz
dexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.tar.zst
dexon-0c63646ca8b06bb527737cd6e2a7fe58f169efff.zip
core: merge notarySet and DKGSet (#265)
* vendor: sync to latest core * core: merge notarySet and dkgSet * dex: optimize network traffic for finalized block
Diffstat (limited to 'core/governance.go')
-rw-r--r--core/governance.go20
1 files changed, 2 insertions, 18 deletions
diff --git a/core/governance.go b/core/governance.go
index 68d5de821..b39fdc3c6 100644
--- a/core/governance.go
+++ b/core/governance.go
@@ -146,7 +146,6 @@ func (g *Governance) Configuration(round uint64) *coreTypes.Config {
LambdaBA: time.Duration(c.LambdaBA) * time.Millisecond,
LambdaDKG: time.Duration(c.LambdaDKG) * time.Millisecond,
NotarySetSize: c.NotarySetSize,
- DKGSetSize: c.DKGSetSize,
RoundLength: c.RoundLength,
MinBlockInterval: time.Duration(c.MinBlockInterval) * time.Millisecond,
}
@@ -199,21 +198,6 @@ func (d *Governance) NotarySetNodeKeyAddresses(round uint64) (map[common.Address
return r, nil
}
-func (d *Governance) DKGSet(round uint64) (map[string]struct{}, error) {
- dkgSet, err := d.nodeSetCache.GetDKGSet(round)
- if err != nil {
- return nil, err
- }
-
- r := make(map[string]struct{}, len(dkgSet))
- for id := range dkgSet {
- if key, exists := d.nodeSetCache.GetPublicKey(id); exists {
- r[hex.EncodeToString(key.Bytes())] = struct{}{}
- }
- }
- return r, nil
-}
-
func (g *Governance) DKGComplaints(round uint64) []*dkgTypes.Complaint {
s := g.GetStateForDKGAtRound(round)
if s == nil {
@@ -245,7 +229,7 @@ func (g *Governance) IsDKGMPKReady(round uint64) bool {
return false
}
config := g.Configuration(round)
- threshold := 2*uint64(config.DKGSetSize)/3 + 1
+ threshold := 2*uint64(config.NotarySetSize)/3 + 1
count := s.DKGMPKReadysCount().Uint64()
return count >= threshold
}
@@ -256,7 +240,7 @@ func (g *Governance) IsDKGFinal(round uint64) bool {
return false
}
config := g.Configuration(round)
- threshold := 2*uint64(config.DKGSetSize)/3 + 1
+ threshold := 2*uint64(config.NotarySetSize)/3 + 1
count := s.DKGFinalizedsCount().Uint64()
return count >= threshold
}