pub fn finish(self) -> Result<Handshake<S, C>, &'static str> {
        let config = self.config.ok_or("did not specify config")?;
        let inbound_service = self
            .inbound_service
            .ok_or("did not specify inbound service")?;
        let inv_collector = self.inv_collector.unwrap_or_else(|| {
            let (tx, _) = broadcast::channel(100);
            tx
        });
        let address_book_updater = self.address_book_updater.unwrap_or_else(|| {
            // No `AddressBookUpdater` for timestamp collection was passed, so create a stub
            // channel. Dropping the receiver means sends will fail, but we don't care.
            let (tx, _rx) = tokio::sync::mpsc::channel(1);
            tx
        });
        let nonces = Arc::new(futures::lock::Mutex::new(HashSet::new()));
        let user_agent = self.user_agent.unwrap_or_else(|| "".to_string());
        let our_services = self.our_services.unwrap_or_else(PeerServices::empty);
        let relay = self.relay.unwrap_or(false);
        let network = config.network;
        let minimum_peer_version = MinimumPeerVersion::new(self.latest_chain_tip, network);

        Ok(Handshake {
            config,
            inbound_service,
            inv_collector,
            address_book_updater,
            nonces,
            user_agent,
            our_services,
            relay,
            parent_span: Span::current(),
            minimum_peer_version,
        })
    }
/// Consume this builder and produce a [`Handshake`].
///
/// Returns an error only if any mandatory field was unset.
Consume this builder and produce a [`Handshake`].
Returns an error only if any mandatory field was unset.
Consume this builder and produce a [ ` Handshake ` ] . Returns an error only if any mandatory field was unset .
pub fn finish(self) -> Result<Handshake<S, C>, &'static str> {
        let config = self.config.ok_or("did not specify config")?;
        let inbound_service = self
            .inbound_service
            .ok_or("did not specify inbound service")?;
        let inv_collector = self.inv_collector.unwrap_or_else(|| {
            let (tx, _) = broadcast::channel(100);
            tx
        });
        let address_book_updater = self.address_book_updater.unwrap_or_else(|| {
            // No `AddressBookUpdater` for timestamp collection was passed, so create a stub
            // channel. Dropping the receiver means sends will fail, but we don't care.
            let (tx, _rx) = tokio::sync::mpsc::channel(1);
            tx
        });
        let nonces = Arc::new(futures::lock::Mutex::new(HashSet::new()));
        let user_agent = self.user_agent.unwrap_or_else(|| "".to_string());
        let our_services = self.our_services.unwrap_or_else(PeerServices::empty);
        let relay = self.relay.unwrap_or(false);
        let network = config.network;
        let minimum_peer_version = MinimumPeerVersion::new(self.latest_chain_tip, network);
        Ok(Handshake {
            config,
            inbound_service,
            inv_collector,
            address_book_updater,
            nonces,
            user_agent,
            our_services,
            relay,
            parent_span: Span::current(),
            minimum_peer_version,
        })
    }
pub fn finish ( self ) -> Result < Handshake < S , C > , & ' static str > { let config = self . config . ok_or ( " " ) ? ; let inbound_service = self . inbound_service . ok_or ( " " ) ? ; let inv_collector = self . inv_collector . unwrap_or_else ( | | { let ( tx , _ ) = broadcast :: channel ( 100 ) ; tx } ) ; let address_book_updater = self . address_book_updater . unwrap_or_else ( | | { // No `AddressBookUpdater` for timestamp collection was passed, so create a stub // channel. Dropping the receiver means sends will fail, but we don't care. let ( tx , _rx ) = tokio :: sync :: mpsc :: channel ( 1 ) ; tx } ) ; let nonces = Arc :: new ( futures :: lock :: Mutex :: new ( HashSet :: new ( ) ) ) ; let user_agent = self . user_agent . unwrap_or_else ( | | " " . to_string ( ) ) ; let our_services = self . our_services . unwrap_or_else ( PeerServices :: empty ) ; let relay = self . relay . unwrap_or ( false ) ; let network = config . network ; let minimum_peer_version = MinimumPeerVersion :: new ( self . latest_chain_tip , network ) ; Ok ( Handshake { config , inbound_service , inv_collector , address_book_updater , nonces , user_agent , our_services , relay , parent_span : Span :: current ( ) , minimum_peer_version , } ) }
Consume this builder and produce a [`Handshake`].
Consume this builder and produce a [ ` Handshake ` ] .
self