From 61d450c611a0c04db2f7901ee407dd9bed51db98 Mon Sep 17 00:00:00 2001 From: Vicente Vieytes Date: Fri, 23 Aug 2024 17:22:39 -0300 Subject: [PATCH] uncomment p2p networking functionality, rename to RpcApiContext --- cmd/ethereum_rust/ethereum_rust.rs | 8 ++++---- crates/rpc/rpc.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/ethereum_rust/ethereum_rust.rs b/cmd/ethereum_rust/ethereum_rust.rs index fff55f4f6..03ddfc9d4 100644 --- a/cmd/ethereum_rust/ethereum_rust.rs +++ b/cmd/ethereum_rust/ethereum_rust.rs @@ -72,9 +72,9 @@ async fn main() { let authrpc_socket_addr = parse_socket_addr(authrpc_addr, authrpc_port) .expect("Failed to parse authrpc address and port"); - let _udp_socket_addr = + let udp_socket_addr = parse_socket_addr(udp_addr, udp_port).expect("Failed to parse discovery address and port"); - let _tcp_socket_addr = + let tcp_socket_addr = parse_socket_addr(tcp_addr, tcp_port).expect("Failed to parse addr and port"); let mut store = match matches.get_one::("datadir") { @@ -99,9 +99,9 @@ async fn main() { let jwt_secret = read_jwtsecret_file(authrpc_jwtsecret); let rpc_api = ethereum_rust_rpc::start_api(http_socket_addr, authrpc_socket_addr, store, jwt_secret); - //let networking = ethereum_rust_net::start_network(udp_socket_addr, tcp_socket_addr, bootnodes); + let networking = ethereum_rust_net::start_network(udp_socket_addr, tcp_socket_addr, bootnodes); - try_join!(tokio::spawn(rpc_api) /*, tokio::spawn(networking)*/).unwrap(); + try_join!(tokio::spawn(rpc_api), tokio::spawn(networking)).unwrap(); } fn read_jwtsecret_file(jwt_secret_path: &str) -> Bytes { diff --git a/crates/rpc/rpc.rs b/crates/rpc/rpc.rs index 774c3ad9a..254ceae11 100644 --- a/crates/rpc/rpc.rs +++ b/crates/rpc/rpc.rs @@ -34,7 +34,7 @@ use axum::extract::State; use ethereum_rust_storage::Store; #[derive(Debug, Clone)] -pub struct ServiceContext { +pub struct RpcApiContext { storage: Store, jwt_secret: Bytes, } @@ -45,7 +45,7 @@ pub async fn start_api( storage: Store, jwt_secret: Bytes, ) { - let service_context = ServiceContext { + let service_context = RpcApiContext { storage: storage.clone(), jwt_secret, }; @@ -80,7 +80,7 @@ async fn shutdown_signal() { } pub async fn handle_http_request( - State(service_context): State, + State(service_context): State, body: String, ) -> Json { let storage = service_context.storage; @@ -90,7 +90,7 @@ pub async fn handle_http_request( } pub async fn handle_authrpc_request( - State(service_context): State, + State(service_context): State, auth_header: Option>>, body: String, ) -> Json {