Skip to content

Commit 342e5cf

Browse files
Sergio Valverdejgraef
Sergio Valverde
authored andcommitted
Remove const_int_pow feature flag
const_int_pow was stabilized in Rust 1.50.0 rust-lang/rust#76829
1 parent a664218 commit 342e5cf

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,8 @@ impl Network {
299299
GossipsubEvent::Message(peer_id, msg_id, msg) => {
300300
log::trace!("Received message {:?} from peer {:?}: {:?}", msg_id, peer_id, msg);
301301
for topic in msg.topics.iter() {
302-
if let Some(output) = state.gossip_topics.get(&topic) {
303-
// let peer = Self::get_peer(peer_id).unwrap();
304-
output.send((msg, peer));
302+
if let Some(output) = state.gossip_topics.get_mut(&topic) {
303+
output.send((msg.clone(), peer_id.clone())).await.ok();
305304
} else {
306305
log::warn!("Unknown topic hash: {:?}", topic);
307306
}
@@ -401,7 +400,7 @@ impl NetworkInterface for Network {
401400
self.events_tx.subscribe()
402401
}
403402

404-
async fn subscribe<T>(&self, topic: &T) -> Box<dyn Stream<Item = (T::Item, Arc<Self::PeerType>)> + Send>
403+
async fn subscribe<T>(&self, topic: &T) -> Box<dyn Stream<Item = (T::Item, PeerId)> + Send>
405404
where
406405
T: Topic + Sync,
407406
{
@@ -417,9 +416,9 @@ impl NetworkInterface for Network {
417416
.await
418417
.expect("Couldn't subscribe to pubsub topic");
419418

420-
Box::new(rx.map(|(msg, peer)| {
421-
let item: <T as Topic>::Item = Deserialize::deserialize_from_vec(&msg.data);
422-
(item, peer)
419+
Box::new(rx.map(|(msg, peer_id)| {
420+
let item: <T as Topic>::Item = Deserialize::deserialize_from_vec(&msg.data).unwrap();
421+
(item, peer_id)
423422
}))
424423
}
425424

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)