mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
* Revert "chore: update libp2p to 0.52.1 (#14429)"
This reverts commit 59d8b86450.
* Fix dependencies
* Update dependencies
* Update Cargo.lock
This commit is contained in:
@@ -986,7 +986,7 @@ impl Notifications {
|
||||
|
||||
impl NetworkBehaviour for Notifications {
|
||||
type ConnectionHandler = NotifsHandler;
|
||||
type ToSwarm = NotificationsOut;
|
||||
type OutEvent = NotificationsOut;
|
||||
|
||||
fn handle_pending_inbound_connection(
|
||||
&mut self,
|
||||
@@ -1459,11 +1459,10 @@ impl NetworkBehaviour for Notifications {
|
||||
FromSwarm::ListenerClosed(_) => {},
|
||||
FromSwarm::ListenFailure(_) => {},
|
||||
FromSwarm::ListenerError(_) => {},
|
||||
FromSwarm::ExternalAddrExpired(_) => {},
|
||||
FromSwarm::ExpiredExternalAddr(_) => {},
|
||||
FromSwarm::NewListener(_) => {},
|
||||
FromSwarm::ExpiredListenAddr(_) => {},
|
||||
FromSwarm::NewExternalAddrCandidate(_) => {},
|
||||
FromSwarm::ExternalAddrConfirmed(_) => {},
|
||||
FromSwarm::NewExternalAddr(_) => {},
|
||||
FromSwarm::AddressChange(_) => {},
|
||||
FromSwarm::NewListenAddr(_) => {},
|
||||
}
|
||||
@@ -2002,7 +2001,7 @@ impl NetworkBehaviour for Notifications {
|
||||
&mut self,
|
||||
cx: &mut Context,
|
||||
_params: &mut impl PollParameters,
|
||||
) -> Poll<ToSwarm<Self::ToSwarm, THandlerInEvent<Self>>> {
|
||||
) -> Poll<ToSwarm<Self::OutEvent, THandlerInEvent<Self>>> {
|
||||
if let Some(event) = self.events.pop_front() {
|
||||
return Poll::Ready(event)
|
||||
}
|
||||
@@ -2108,6 +2107,7 @@ mod tests {
|
||||
protocol::notifications::handler::tests::*,
|
||||
protocol_controller::{IncomingIndex, ProtoSetConfig, ProtocolController},
|
||||
};
|
||||
use libp2p::swarm::AddressRecord;
|
||||
use sc_utils::mpsc::tracing_unbounded;
|
||||
use std::{collections::HashSet, iter};
|
||||
|
||||
@@ -2127,14 +2127,31 @@ mod tests {
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MockPollParams {}
|
||||
struct MockPollParams {
|
||||
peer_id: PeerId,
|
||||
addr: Multiaddr,
|
||||
}
|
||||
|
||||
impl PollParameters for MockPollParams {
|
||||
type SupportedProtocolsIter = std::vec::IntoIter<Vec<u8>>;
|
||||
type ListenedAddressesIter = std::vec::IntoIter<Multiaddr>;
|
||||
type ExternalAddressesIter = std::vec::IntoIter<AddressRecord>;
|
||||
|
||||
fn supported_protocols(&self) -> Self::SupportedProtocolsIter {
|
||||
vec![].into_iter()
|
||||
}
|
||||
|
||||
fn listened_addresses(&self) -> Self::ListenedAddressesIter {
|
||||
vec![self.addr.clone()].into_iter()
|
||||
}
|
||||
|
||||
fn external_addresses(&self) -> Self::ExternalAddressesIter {
|
||||
vec![].into_iter()
|
||||
}
|
||||
|
||||
fn local_peer_id(&self) -> &PeerId {
|
||||
&self.peer_id
|
||||
}
|
||||
}
|
||||
|
||||
fn development_notifs() -> (Notifications, ProtocolController) {
|
||||
@@ -2999,7 +3016,7 @@ mod tests {
|
||||
|
||||
notif.on_swarm_event(FromSwarm::DialFailure(libp2p::swarm::behaviour::DialFailure {
|
||||
peer_id: Some(peer),
|
||||
error: &libp2p::swarm::DialError::Aborted,
|
||||
error: &libp2p::swarm::DialError::Banned,
|
||||
connection_id: ConnectionId::new_unchecked(1337),
|
||||
}));
|
||||
|
||||
@@ -3536,7 +3553,7 @@ mod tests {
|
||||
let now = Instant::now();
|
||||
notif.on_swarm_event(FromSwarm::DialFailure(libp2p::swarm::behaviour::DialFailure {
|
||||
peer_id: Some(peer),
|
||||
error: &libp2p::swarm::DialError::Aborted,
|
||||
error: &libp2p::swarm::DialError::Banned,
|
||||
connection_id: ConnectionId::new_unchecked(0),
|
||||
}));
|
||||
|
||||
@@ -3656,7 +3673,7 @@ mod tests {
|
||||
assert!(notif.peers.get(&(peer, set_id)).is_some());
|
||||
|
||||
if tokio::time::timeout(Duration::from_secs(5), async {
|
||||
let mut params = MockPollParams {};
|
||||
let mut params = MockPollParams { peer_id: PeerId::random(), addr: Multiaddr::empty() };
|
||||
|
||||
loop {
|
||||
futures::future::poll_fn(|cx| {
|
||||
@@ -3765,7 +3782,7 @@ mod tests {
|
||||
// verify that the code continues to keep the peer disabled by resetting the timer
|
||||
// after the first one expired.
|
||||
if tokio::time::timeout(Duration::from_secs(5), async {
|
||||
let mut params = MockPollParams {};
|
||||
let mut params = MockPollParams { peer_id: PeerId::random(), addr: Multiaddr::empty() };
|
||||
|
||||
loop {
|
||||
futures::future::poll_fn(|cx| {
|
||||
|
||||
Reference in New Issue
Block a user