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

Commit

Permalink
fix: post-rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
oetyng committed Feb 23, 2021
1 parent bdbb970 commit 906ef03
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
16 changes: 8 additions & 8 deletions src/routing/approved.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ impl Approved {
let response = NetworkInfoMsg::GetSectionResponse(response);
debug!("Sending {:?} to {}", response, sender);

Ok(vec![Command::SendMessage {
vec![Command::SendMessage {
recipients: vec![sender],
delivery_group_size: 1,
message: MessageType::NetworkInfo(response),
}])
}]
}
NetworkInfoMsg::GetSectionResponse(_) => {
if let Some(RelocateState::InProgress(tx)) = &mut self.relocate_state {
trace!("Forwarding {:?} to the bootstrap task", message);
let _ = tx.send((MessageType::NetworkInfo(message), sender)).await;
}

Ok(vec![])
vec![]
}
NetworkInfoMsg::NetworkInfoUpdate(error) => {
error!("TargetSectionError received: {:?}", error);
Expand Down Expand Up @@ -1860,21 +1860,21 @@ impl Approved {
Ok(Some(command))
}

pub fn check_key_status(&self, bls_pk: &bls::PublicKey) -> Result<(), TagetSectionError> {
pub fn check_key_status(&self, bls_pk: &bls::PublicKey) -> Result<(), TargetSectionError> {
// 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(TagetSectionError::DkgInProgress);
return Err(TargetSectionError::DkgInProgress);
}
if !self.section.chain().has_key(bls_pk) {
return Err(TagetSectionError::UnrecognizedSectionKey);
return Err(TargetSectionError::UnrecognizedSectionKey);
}
if bls_pk != self.section.chain().last_key() {
if let Ok(public_key_set) = self.public_key_set() {
return Err(TagetSectionError::TargetSectionInfoOutdated(NetworkInfo {
return Err(TargetSectionError::TargetSectionInfoOutdated(NetworkInfo {
prefix: *self.section.prefix(),
pk_set: public_key_set,
elders: self
Expand All @@ -1885,7 +1885,7 @@ impl Approved {
.collect(),
}));
} else {
return Err(TagetSectionError::DkgInProgress);
return Err(TargetSectionError::DkgInProgress);
}
}
Ok(())
Expand Down
5 changes: 1 addition & 4 deletions src/routing/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use std::{
collections::{BTreeMap, VecDeque},
mem,
net::SocketAddr,
unimplemented,
};
use tokio::sync::mpsc;
use tracing::Instrument;
Expand Down Expand Up @@ -573,7 +572,7 @@ mod tests {
use anyhow::{Error, Result};
use assert_matches::assert_matches;
use futures::future::{self, Either};
use sn_messaging::infrastructure::NetworkInfo;
use sn_messaging::network_info::NetworkInfo;
use tokio::{sync::mpsc::error::TryRecvError, task};

#[tokio::test]
Expand Down Expand Up @@ -781,8 +780,6 @@ mod tests {

#[tokio::test]
async fn invalid_get_section_response_success() -> Result<()> {
let mut rng = rand::thread_rng();

let (send_tx, mut send_rx) = mpsc::channel(1);
let (mut recv_tx, recv_rx) = mpsc::channel(1);
let recv_rx = MessageReceiver::Deserialized(recv_rx);
Expand Down
13 changes: 6 additions & 7 deletions src/routing/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,12 @@ impl Stage {
.handle_message(sender, message)
.await
}
Command::HandleNetworkInfoMsg { sender, message } => {
self.state
.lock()
.await
.handle_networkinfo_msg(sender, message)
.await
}
Command::HandleNetworkInfoMsg { sender, message } => Ok(self
.state
.lock()
.await
.handle_networkinfo_msg(sender, message)
.await),
Command::HandleTimeout(token) => self.state.lock().await.handle_timeout(token),
Command::HandleVote { vote, proof_share } => {
self.state.lock().await.handle_vote(vote, proof_share)
Expand Down

0 comments on commit 906ef03

Please sign in to comment.