Skip to content

Commit

Permalink
uncomment p2p networking functionality, rename to RpcApiContext
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentevieytes committed Aug 23, 2024
1 parent a628f83 commit 61d450c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cmd/ethereum_rust/ethereum_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<String>("datadir") {
Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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,
};
Expand Down Expand Up @@ -80,7 +80,7 @@ async fn shutdown_signal() {
}

pub async fn handle_http_request(
State(service_context): State<ServiceContext>,
State(service_context): State<RpcApiContext>,
body: String,
) -> Json<Value> {
let storage = service_context.storage;
Expand All @@ -90,7 +90,7 @@ pub async fn handle_http_request(
}

pub async fn handle_authrpc_request(
State(service_context): State<ServiceContext>,
State(service_context): State<RpcApiContext>,
auth_header: Option<TypedHeader<Authorization<Bearer>>>,
body: String,
) -> Json<Value> {
Expand Down

0 comments on commit 61d450c

Please sign in to comment.