diff --git a/crates/rpc/rpc/src/eth/api/mod.rs b/crates/rpc/rpc/src/eth/api/mod.rs index c081a9a49304..ef40989df40d 100644 --- a/crates/rpc/rpc/src/eth/api/mod.rs +++ b/crates/rpc/rpc/src/eth/api/mod.rs @@ -139,6 +139,8 @@ where task_spawner, pending_block: Default::default(), blocking_task_pool, + #[cfg(feature = "optimism")] + http_client: reqwest::Client::new(), }; Self { inner: Arc::new(inner) } } @@ -446,4 +448,7 @@ struct EthApiInner { pending_block: Mutex>, /// A pool dedicated to blocking tasks. blocking_task_pool: BlockingTaskPool, + /// An http client for communicating with sequencers. + #[cfg(feature = "optimism")] + http_client: reqwest::Client, } diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index e398dc6f1b0c..2b6efcf5b1da 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -982,9 +982,8 @@ where EthApiError::InternalEthError })?; - let client = reqwest::Client::new(); - - client + self.inner + .http_client .post(endpoint) .header(http::header::CONTENT_TYPE, "application/json") .body(body)