aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-19 17:16:40 +0800
committerGitHub <noreply@github.com>2018-12-19 17:16:40 +0800
commitc7b4045802450df361216d9e7da3ec318e67cc34 (patch)
treec4060817a54e5cf455e830b21e6a91b9fc11004f /core/consensus.go
parent7bafefa5c70a26a28636123cb2b6598eea3ed380 (diff)
downloaddexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.tar
dexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.tar.gz
dexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.tar.bz2
dexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.tar.lz
dexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.tar.xz
dexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.tar.zst
dexon-consensus-c7b4045802450df361216d9e7da3ec318e67cc34.zip
core: Add a `MPKReady` so `MasterPublicKey` cannot be added afterwards (#375)
* Add type DKGReady * Add DKGReady to interface and state * DKG will wait for MPK to be ready before running * Modify test * Check if self's MPK is registered * Add test for delay add MPK * Rename Ready to MPKReady
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/consensus.go b/core/consensus.go
index 741330e..bf49a72 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -329,6 +329,16 @@ func (recv *consensusDKGReceiver) ProposeDKGAntiNackComplaint(
recv.network.BroadcastDKGPrivateShare(prv)
}
+// ProposeDKGMPKReady propose a DKGMPKReady message.
+func (recv *consensusDKGReceiver) ProposeDKGMPKReady(ready *typesDKG.MPKReady) {
+ if err := recv.authModule.SignDKGMPKReady(ready); err != nil {
+ recv.logger.Error("Failed to sign DKG ready", "error", err)
+ return
+ }
+ recv.logger.Debug("Calling Governance.AddDKGFinalize", "ready", ready)
+ recv.gov.AddDKGMPKReady(ready.Round, ready)
+}
+
// ProposeDKGFinalize propose a DKGFinalize message.
func (recv *consensusDKGReceiver) ProposeDKGFinalize(final *typesDKG.Finalize) {
if err := recv.authModule.SignDKGFinalize(final); err != nil {
@@ -631,7 +641,7 @@ func (con *Consensus) runCRS(round uint64) {
}
con.logger.Debug("Calling Governance.IsDKGFinal to check if ready to run CRS",
"round", round)
- if con.cfgModule.isDKGReady(round) {
+ if con.cfgModule.isDKGFinal(round) {
break
}
con.logger.Debug("DKG is not ready for running CRS. Retry later...",