zebra_network::peer::handshake

Function negotiate_version

source
pub async fn negotiate_version<PeerTransport>(
    peer_conn: &mut Framed<PeerTransport, Codec>,
    connected_addr: &ConnectedAddr,
    config: Config,
    nonces: Arc<Mutex<IndexSet<Nonce>>>,
    user_agent: String,
    our_services: PeerServices,
    relay: bool,
    minimum_peer_version: MinimumPeerVersion<impl ChainTip>,
) -> Result<Arc<ConnectionInfo>, HandshakeError>
where PeerTransport: AsyncRead + AsyncWrite + Unpin + Send + 'static,
Expand description

Negotiate the Zcash network protocol version with the remote peer at connected_addr, using the connection peer_conn.

We split Handshake into its components before calling this function, to avoid infectious Sync bounds on the returned future.

Returns the VersionMessage sent by the remote peer, and the Version negotiated with the remote peer, inside a ConnectionInfo struct.