Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
node/test: check remote events for `Event::PeerDisconnected`
Fintan Halpenny committed 2 months ago
commit a4806f2718a7c0fcbf73631e19b7ed9dd8eb8f52
parent 1fa14ef
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();