Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node/test: check remote events for `Event::PeerDisconnected`
Fintan Halpenny committed 2 months ago
commit 4d9f70194cedfe4fa02bdf98997a5a8320d1513a
parent f98afd838868bed39cdbacae4ead1358a781c055
1 file changed +6 -1
modified crates/radicle-node/src/test/node.rs
@@ -99,6 +99,9 @@ impl<G: 'static> Drop for NodeHandle<G> {

impl<G: Signer<Signature> + cyphernet::Ecdh> NodeHandle<G> {
    /// Connect this node to another node, and wait for the connection to be established both ways.
+
    ///
+
    /// If the remote has blocked this node, then the remote event will be
+
    /// [`Event::PeerDisconnected`].
    pub fn connect(&mut self, remote: &NodeHandle<G>) -> &mut Self {
        let local_events = self.handle.events();
        let remote_events = remote.handle.events();
@@ -119,7 +122,9 @@ impl<G: Signer<Signature> + cyphernet::Ecdh> NodeHandle<G> {
            .iter()
            .find(|e| {
                matches!(
-
                    e, Event::PeerConnected { nid } if nid == &self.id
+
                    e,
+
                    Event::PeerConnected { nid } | Event::PeerDisconnected { nid, .. }
+
                    if nid == &self.id
                )
            })
            .unwrap();