Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
feat: having EldersInfo change candidate considered as DKG in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi committed Feb 16, 2021
1 parent ca60a4b commit 6137123
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/consensus/dkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,6 @@ impl DkgVoter {
}
}

// Checks whether there is any on-going DKG session.
pub fn has_ongoing_dkg(&self) -> bool {
self.sessions
.values()
.any(|session| !session.is_finalized())
}

// Handle a received DkgMessage.
pub fn process_message(
&mut self,
Expand Down Expand Up @@ -377,10 +370,6 @@ impl Session {
}
}

fn is_finalized(&self) -> bool {
self.key_gen.is_finalized()
}

fn report_failure(&mut self, dkg_key: &DkgKey, keypair: &Keypair) -> Vec<DkgCommand> {
let proof = DkgFailureProof::new(keypair, dkg_key);

Expand Down
7 changes: 6 additions & 1 deletion src/routing/approved.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,12 @@ impl Approved {
}

pub fn check_key_status(&self, bls_pk: &bls::PublicKey) -> Result<(), InfrastructureError> {
if self.dkg_voter.has_ongoing_dkg() {
// Whenever there is EldersInfo change candidate, it is considered as having ongoing DKG.
if !self
.section
.promote_and_demote_elders(&self.node.name())
.is_empty()
{
return Err(InfrastructureError::DkgInProgress);
}
if !self.section.chain().has_key(bls_pk) {
Expand Down

0 comments on commit 6137123

Please sign in to comment.