Skip to content

Commit 51d1caa

Browse files
author
Sergio Valverde
committed
Remove const_int_pow feature flag
const_int_pow was stabilized in Rust 1.50.0 rust-lang/rust#76829
1 parent fcb091c commit 51d1caa

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

nano-sync/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![allow(dead_code)]
2-
#![feature(const_int_pow)]
32

43
// Re-export big-endian serialization of algebra types.
54
pub use nimiq_bls::compression;

network-albatross/src/network.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl NetworkInterface for Network {
429429
unimplemented!()
430430
}
431431

432-
async fn subscribe<T>(&self, _topic: &T) -> Box<dyn Stream<Item = (T::Item, Arc<Self::PeerType>)> + Send>
432+
async fn subscribe<T>(&self, _topic: &T) -> Box<dyn Stream<Item = (T::Item, <Self::PeerType as PeerInterface>::Id)> + Send>
433433
where
434434
T: Topic + Sync,
435435
{

network-interface/src/network.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub trait Network: Send + Sync + 'static {
7171
ReceiveFromAll::new(self)
7272
}
7373

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

network-libp2p/src/network.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub enum NetworkAction {
127127
},
128128
RegisterTopic {
129129
topic_hash: TopicHash,
130-
output: mpsc::Sender<(GossipsubMessage, Arc<Peer>)>,
130+
output: mpsc::Sender<(GossipsubMessage, PeerId)>,
131131
},
132132
Subscribe {
133133
topic_name: &'static str,
@@ -145,7 +145,7 @@ struct TaskState {
145145
dht_puts: HashMap<QueryId, oneshot::Sender<Result<(), NetworkError>>>,
146146
dht_gets: HashMap<QueryId, oneshot::Sender<Result<Vec<u8>, NetworkError>>>,
147147
gossip_sub: HashMap<TopicHash, oneshot::Sender<TopicHash>>,
148-
gossip_topics: HashMap<TopicHash, mpsc::Sender<(GossipsubMessage, Arc<Peer>)>>,
148+
gossip_topics: HashMap<TopicHash, mpsc::Sender<(GossipsubMessage, PeerId)>>,
149149
}
150150

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

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

439-
Box::new(rx.map(|(msg, peer)| {
440-
let item: <T as Topic>::Item = Deserialize::deserialize_from_vec(&msg.data);
441-
(item, peer)
438+
Box::new(rx.map(|(msg, peer_id)| {
439+
let item: <T as Topic>::Item = Deserialize::deserialize_from_vec(&msg.data).unwrap();
440+
(item, peer_id)
442441
}))
443442
}
444443

network-mock/src/network.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl Network for MockNetwork {
236236
self.event_tx.subscribe()
237237
}
238238

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

0 commit comments

Comments
 (0)