Skip to content

Commit

Permalink
fix(sn_node): do not cast handover vote after aggregated
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi authored and joshuef committed Mar 29, 2023
1 parent 4eef5f9 commit d517086
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ impl SapCandidate {
}
}
}

pub fn public_key_set(&self) -> PublicKeySet {
match self {
SapCandidate::ElderHandover(sap) => sap.public_key_set(),
// TODO: consider return both?
SapCandidate::SectionSplit(sap1, _sap2) => sap1.public_key_set(),
}
}
}

impl Debug for SectionAuthorityProvider {
Expand Down
2 changes: 1 addition & 1 deletion sn_node/src/bin/safenode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ fn monitor_node_events(
}
_ => {
/* we are not interested in any other type of node events here */
info!("Received an un-interested node event {event:?}");
info!("Dropping an event we currently don't expose through gRPC: {event:?}");
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions sn_node/src/node/handover/handover_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ impl Handover {
}

pub(crate) fn propose(&mut self, proposal: SapCandidate) -> Result<SignedVote<SapCandidate>> {
// Do not cast a vote equals to self sap
if self.consensus.elders == proposal.public_key_set() {
error!("Cannot casting a proposal {proposal:?} as we are already on it");
return Err(Error::FaultyProposal);
}

let vote = Vote {
gen: self.gen,
ballot: Ballot::Propose(proposal.clone()),
Expand Down
9 changes: 0 additions & 9 deletions sn_node/src/node/messaging/dkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,15 +863,6 @@ impl MyNode {
}
}

// // Do we really need this update currently?
// // Shall the update only get carried out when the network_knowledge has the chain key?
// match self.update_on_sap_change(&self.context()).await {
// Ok(update_cmds) => cmds.extend(update_cmds),
// Err(err) => {
// error!("Failed on handle DKG outcome of {key_share_pk:?} during knowledge update: {err:?}")
// }
// }

Ok(cmds)
}
}
Expand Down

0 comments on commit d517086

Please sign in to comment.