mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat(net): make Status and Hello configurable (#431)
* feat(net): make Status and Hello configurable * set port
This commit is contained in:
@ -87,6 +87,34 @@ async fn test_connect_with_boot_nodes() {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn test_connect_with_builder() {
|
||||
reth_tracing::init_tracing();
|
||||
let secret_key = SecretKey::new(&mut rand::thread_rng());
|
||||
let mut discv4 = Discv4Config::builder();
|
||||
discv4.add_boot_nodes(mainnet_nodes());
|
||||
|
||||
let client = Arc::new(TestApi::default());
|
||||
let config = NetworkConfig::builder(Arc::clone(&client), secret_key).discovery(discv4).build();
|
||||
let (handle, network, _, requests) = NetworkManager::new(config)
|
||||
.await
|
||||
.unwrap()
|
||||
.into_builder()
|
||||
.request_handler(client)
|
||||
.split_with_handle();
|
||||
|
||||
let mut events = handle.event_listener();
|
||||
|
||||
tokio::task::spawn(async move {
|
||||
tokio::join!(network, requests);
|
||||
});
|
||||
|
||||
while let Some(ev) = events.next().await {
|
||||
dbg!(ev);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_incoming_node_id_blacklist() {
|
||||
reth_tracing::init_tracing();
|
||||
@ -200,7 +228,7 @@ async fn test_outgoing_connect_with_single_geth() {
|
||||
let geth_socket = SocketAddr::new([127, 0, 0, 1].into(), geth_p2p_port);
|
||||
let geth_endpoint = SocketAddr::new([127, 0, 0, 1].into(), geth.port()).to_string();
|
||||
|
||||
let provider = Provider::<Http>::try_from(format!("http://{}", geth_endpoint)).unwrap();
|
||||
let provider = Provider::<Http>::try_from(format!("http://{geth_endpoint}")).unwrap();
|
||||
|
||||
// get the peer id we should be expecting
|
||||
let geth_peer_id: PeerId =
|
||||
|
||||
Reference in New Issue
Block a user