async fn local_listener_port_with(listen_addr: SocketAddr, network: Network) {
    let config = Config {
        listen_addr,
        network,

        // Stop Zebra making outbound connections
        initial_mainnet_peers: HashSet::new(),
        initial_testnet_peers: HashSet::new(),

        ..Config::default()
    };
    let inbound_service =
        service_fn(|_| async { unreachable!("inbound service should never be called") });

    let (_peer_service, address_book) = init(config, inbound_service, NoChainTip).await;
    let local_listener = address_book.lock().unwrap().local_listener_meta_addr();

    if listen_addr.port() == 0 {
        assert_ne!(
            local_listener.addr.port(),
            0,
            "dynamic ports are replaced with OS-assigned ports"
        );
    } else {
        assert_eq!(
            local_listener.addr.port(),
            listen_addr.port(),
            "fixed ports are correctly propagated"
        );
    }

    assert_eq!(
        local_listener.addr.ip(),
        listen_addr.ip(),
        "IP addresses are correctly propagated"
    );
}
/// Open a local listener on `listen_addr` for `network`.
/// Asserts that the local listener address works as expected.
Open a local listener on `listen_addr` for `network`.
Asserts that the local listener address works as expected.
Open a local listener on ` listen_addr ` for ` network ` . Asserts that the local listener address works as expected .
async fn local_listener_port_with(listen_addr: SocketAddr, network: Network) {
    let config = Config {
        listen_addr,
        network,
        // Stop Zebra making outbound connections
        initial_mainnet_peers: HashSet::new(),
        initial_testnet_peers: HashSet::new(),
        ..Config::default()
    };
    let inbound_service =
        service_fn(|_| async { unreachable!("inbound service should never be called") });
    let (_peer_service, address_book) = init(config, inbound_service, NoChainTip).await;
    let local_listener = address_book.lock().unwrap().local_listener_meta_addr();
    if listen_addr.port() == 0 {
        assert_ne!(
            local_listener.addr.port(),
            0,
            "dynamic ports are replaced with OS-assigned ports"
        );
    } else {
        assert_eq!(
            local_listener.addr.port(),
            listen_addr.port(),
            "fixed ports are correctly propagated"
        );
    }
    assert_eq!(
        local_listener.addr.ip(),
        listen_addr.ip(),
        "IP addresses are correctly propagated"
    );
}
async fn local_listener_port_with ( listen_addr : SocketAddr , network : Network ) { let config = Config { listen_addr , network , // Stop Zebra making outbound connections initial_mainnet_peers : HashSet :: new ( ) , initial_testnet_peers : HashSet :: new ( ) , .. Config :: default ( ) } ; let inbound_service = service_fn ( | _ | async { unreachable ! ( " " ) } ) ; let ( _peer_service , address_book ) = init ( config , inbound_service , NoChainTip ) . await ; let local_listener = address_book . lock ( ) . unwrap ( ) . local_listener_meta_addr ( ) ; if listen_addr . port ( ) == 0 { assert_ne ! ( local_listener addr port ( ) 0 " " ) ; } else { assert_eq ! ( local_listener addr port ( ) listen_addr port ( ) " " ) ; } assert_eq ! ( local_listener addr ip ( ) listen_addr ip ( ) " " ) ; }
Open a local listener on `listen_addr` for `network`.
Open a local listener on ` listen_addr ` for ` network ` .
listen_addr
SocketAddr
network
Network