Skip to content

Commit

Permalink
Remove const_int_pow feature flag
Browse files Browse the repository at this point in the history
const_int_pow was stabilized in Rust 1.50.0
rust-lang/rust#76829
  • Loading branch information
Sergio Valverde committed Dec 11, 2020
1 parent fcb091c commit 51d1caa
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion nano-sync/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)]
#![feature(const_int_pow)]

// Re-export big-endian serialization of algebra types.
pub use nimiq_bls::compression;
Expand Down
2 changes: 1 addition & 1 deletion network-albatross/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl NetworkInterface for Network {
unimplemented!()
}

async fn subscribe<T>(&self, _topic: &T) -> Box<dyn Stream<Item = (T::Item, Arc<Self::PeerType>)> + Send>
async fn subscribe<T>(&self, _topic: &T) -> Box<dyn Stream<Item = (T::Item, <Self::PeerType as PeerInterface>::Id)> + Send>
where
T: Topic + Sync,
{
Expand Down
2 changes: 1 addition & 1 deletion network-interface/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub trait Network: Send + Sync + 'static {
ReceiveFromAll::new(self)
}

async fn subscribe<T>(&self, topic: &T) -> Box<dyn Stream<Item = (T::Item, Arc<Self::PeerType>)> + Send>
async fn subscribe<T>(&self, topic: &T) -> Box<dyn Stream<Item = (T::Item, <Self::PeerType as Peer>::Id)> + Send>
where
T: Topic + Sync;

Expand Down
17 changes: 8 additions & 9 deletions network-libp2p/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub enum NetworkAction {
},
RegisterTopic {
topic_hash: TopicHash,
output: mpsc::Sender<(GossipsubMessage, Arc<Peer>)>,
output: mpsc::Sender<(GossipsubMessage, PeerId)>,
},
Subscribe {
topic_name: &'static str,
Expand All @@ -145,7 +145,7 @@ struct TaskState {
dht_puts: HashMap<QueryId, oneshot::Sender<Result<(), NetworkError>>>,
dht_gets: HashMap<QueryId, oneshot::Sender<Result<Vec<u8>, NetworkError>>>,
gossip_sub: HashMap<TopicHash, oneshot::Sender<TopicHash>>,
gossip_topics: HashMap<TopicHash, mpsc::Sender<(GossipsubMessage, Arc<Peer>)>>,
gossip_topics: HashMap<TopicHash, mpsc::Sender<(GossipsubMessage, PeerId)>>,
}

pub struct Network {
Expand Down Expand Up @@ -304,9 +304,8 @@ impl Network {
GossipsubEvent::Message(peer_id, msg_id, msg) => {
log::trace!("Received message {:?} from peer {:?}: {:?}", msg_id, peer_id, msg);
for topic in msg.topics.iter() {
if let Some(output) = state.gossip_topics.get(&topic) {
// let peer = Self::get_peer(peer_id).unwrap();
output.send((msg, peer));
if let Some(output) = state.gossip_topics.get_mut(&topic) {
output.send((msg.clone(), peer_id.clone())).await.ok();
} else {
log::warn!("Unknown topic hash: {:?}", topic);
}
Expand Down Expand Up @@ -409,7 +408,7 @@ impl NetworkInterface for Network {
self.events_tx.subscribe()
}

async fn subscribe<T>(&self, topic: &T) -> Box<dyn Stream<Item = (T::Item, Arc<Self::PeerType>)> + Send>
async fn subscribe<T>(&self, topic: &T) -> Box<dyn Stream<Item = (T::Item, PeerId)> + Send>
where
T: Topic + Sync,
{
Expand All @@ -436,9 +435,9 @@ impl NetworkInterface for Network {
})
.await;

Box::new(rx.map(|(msg, peer)| {
let item: <T as Topic>::Item = Deserialize::deserialize_from_vec(&msg.data);
(item, peer)
Box::new(rx.map(|(msg, peer_id)| {
let item: <T as Topic>::Item = Deserialize::deserialize_from_vec(&msg.data).unwrap();
(item, peer_id)
}))
}

Expand Down
2 changes: 1 addition & 1 deletion network-mock/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl Network for MockNetwork {
self.event_tx.subscribe()
}

async fn subscribe<T>(&self, _topic: &T) -> Box<dyn Stream<Item = (T::Item, Arc<Self::PeerType>)> + Send>
async fn subscribe<T>(&self, _topic: &T) -> Box<dyn Stream<Item = (T::Item, usize)> + Send>
where
T: Topic + Sync,
{
Expand Down

0 comments on commit 51d1caa

Please sign in to comment.