aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-04-19 13:53:20 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-15 22:09:56 +0800
commit8e1194d60b89df925b7d5b53395d0949df4bd4f8 (patch)
tree760146083586068d791ce84a1fe6951c62595345 /vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
parent3f433c2137aaf4cd972009cf61bf325f6a1ad2d3 (diff)
downloadgo-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.tar
go-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.tar.gz
go-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.tar.bz2
go-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.tar.lz
go-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.tar.xz
go-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.tar.zst
go-tangerine-8e1194d60b89df925b7d5b53395d0949df4bd4f8.zip
vendor: sync to latest core
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go35
1 files changed, 2 insertions, 33 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
index e7449c222..3443c9676 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
@@ -820,40 +820,9 @@ func (con *Consensus) prepare(initBlock *types.Block) (err error) {
if _, exist := curNotarySet[con.ID]; !exist {
return
}
- isDKGValid := func() bool {
- nextConfig := utils.GetConfigWithPanic(con.gov, nextRound,
- con.logger)
- if !con.gov.IsDKGFinal(nextRound) {
- con.logger.Error("Next DKG is not final, reset it",
- "round", e.Round,
- "reset", e.Reset)
- return false
- }
- if !con.gov.IsDKGSuccess(nextRound) {
- con.logger.Error("Next DKG is not success, reset it",
- "round", e.Round,
- "reset", e.Reset)
- return false
- }
- gpk, err := typesDKG.NewGroupPublicKey(
- nextRound,
- con.gov.DKGMasterPublicKeys(nextRound),
- con.gov.DKGComplaints(nextRound),
- utils.GetDKGThreshold(nextConfig))
- if err != nil {
- con.logger.Error("Next DKG failed to prepare, reset it",
- "round", e.Round,
- "reset", e.Reset,
- "error", err)
- return false
- }
- if len(gpk.QualifyNodeIDs) < utils.GetDKGValidThreshold(nextConfig) {
- return false
- }
- return true
- }
con.event.RegisterHeight(e.NextDKGResetHeight(), func(uint64) {
- if isDKGValid() {
+ if ok, _ := utils.IsDKGValid(
+ con.gov, con.logger, nextRound, e.Reset); ok {
return
}
// Aborting all previous running DKG protocol instance if any.