Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Undo networking changes
  • Loading branch information
expenses committed Jun 2, 2020
commit c58bf39adf8fe0552248b8b2e37f2ac1a4f99a36
3 changes: 1 addition & 2 deletions network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ exit-future = "0.2.0"
futures-timer = "2.0"
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
wasm-timer = "0.2.4"

[dev-dependencies]

sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
1 change: 1 addition & 0 deletions network/src/legacy/gossip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ pub struct NewLeafActions {
}

impl NewLeafActions {
#[cfg(test)]
pub fn new() -> Self {
NewLeafActions { actions: Vec::new() }
}
Expand Down
5 changes: 4 additions & 1 deletion network/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ pub const POLKADOT_PROTOCOL_NAME: &[u8] = b"/polkadot/1";

pub use crate::legacy::gossip::ChainContext;

pub mod tests;
#[cfg(test)]
mod tests;

// Messages from the service API or network adapter.
enum ServiceToWorkerMsg {
Expand Down Expand Up @@ -118,6 +119,7 @@ enum ServiceToWorkerMsg {
/// Used in tests to ensure that all other messages sent from the same
/// thread have been flushed. Also executes arbitrary logic with the protocl
/// handler.
#[cfg(test)]
Synchronize(Box<dyn FnOnce(&mut ProtocolHandler) + Send>),
}

Expand Down Expand Up @@ -1006,6 +1008,7 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where

let _ = sender.send(checked_messages);
}
#[cfg(test)]
ServiceToWorkerMsg::Synchronize(callback) => {
(callback)(&mut self.protocol_handler)
}
Expand Down
2 changes: 1 addition & 1 deletion network/src/protocol/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct Recorded {
type GossipStreamEntry = (mpsc::UnboundedReceiver<TopicNotification>, oneshot::Sender<()>);

#[derive(Default, Clone)]
pub struct MockGossip {
struct MockGossip {
inner: Arc<Mutex<HashMap<Hash, GossipStreamEntry>>>,
gossip_messages: Arc<Mutex<HashMap<Hash, GossipMessage>>>,
}
Expand Down