pub async fn dial_other_peer(mut p2p_client: Client, to_dial: &Multiaddr) -> anyhow::Result<()> {
    match to_dial.iter().last() {
        Some(Protocol::P2p(hash)) => match PeerId::from_multihash(hash) {
            Ok(peer_id) => p2p_client.dial(&peer_id, to_dial).await,
            Err(_) => anyhow::bail!("Invalid hash provided for Peer ID."),
        },
        _ => anyhow::bail!("Expect peer address to contain Peer ID."),
    }
}
/// Reach out to another node with the specified address
Reach out to another node with the specified address
Reach out to another node with the specified address
pub async fn dial_other_peer(mut p2p_client: Client, to_dial: &Multiaddr) -> anyhow::Result<()> {
    match to_dial.iter().last() {
        Some(Protocol::P2p(hash)) => match PeerId::from_multihash(hash) {
            Ok(peer_id) => p2p_client.dial(&peer_id, to_dial).await,
            Err(_) => anyhow::bail!("Invalid hash provided for Peer ID."),
        },
        _ => anyhow::bail!("Expect peer address to contain Peer ID."),
    }
}
pub async fn dial_other_peer ( mut p2p_client : Client , to_dial : & Multiaddr ) -> anyhow :: Result < ( ) > { match to_dial . iter ( ) . last ( ) { Some ( Protocol :: P2p ( hash ) ) => match PeerId :: from_multihash ( hash ) { Ok ( peer_id ) => p2p_client . dial ( & peer_id , to_dial ) . await , Err ( _ ) => anyhow :: bail ! ( " " ) , } , _ => anyhow :: bail ! ( " " ) , } }
Reach out to another node with the specified address
Reach out to another node with the specified address
p2p_client
Client
to_dial
&Multiaddr
p2p_client
Client
to_dial
&Multiaddr