From dc6f4ecd6c0cb33bdf97b0ba08eab19d8f8728c1 Mon Sep 17 00:00:00 2001 From: skoupidi Date: Thu, 29 Feb 2024 14:26:19 +0200 Subject: [PATCH] darkfid: replaced RpcClient with RpcChadClient --- bin/darkfid/src/main.rs | 9 +++++---- bin/darkfid/src/rpc.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/darkfid/src/main.rs b/bin/darkfid/src/main.rs index 672b00fbc..64dac2187 100644 --- a/bin/darkfid/src/main.rs +++ b/bin/darkfid/src/main.rs @@ -33,7 +33,7 @@ use darkfi::{ cli_desc, net::{settings::SettingsOpt, P2pPtr}, rpc::{ - client::RpcClient, + client::RpcChadClient, jsonrpc::JsonSubscriber, server::{listen_and_serve, RequestHandler}, }, @@ -160,7 +160,7 @@ pub struct Darkfid { /// JSON-RPC connection tracker rpc_connections: Mutex>, /// JSON-RPC client to execute requests to the miner daemon - rpc_client: Option, + rpc_client: Option, } impl Darkfid { @@ -169,7 +169,7 @@ impl Darkfid { miners_p2p: Option, validator: ValidatorPtr, subscribers: HashMap<&'static str, JsonSubscriber>, - rpc_client: Option, + rpc_client: Option, ) -> Self { Self { sync_p2p, @@ -248,7 +248,8 @@ async fn realmain(args: Args, ex: Arc>) -> Result<()> { // Initialize miners P2P network let (miners_p2p, rpc_client) = if blockchain_config.miner { - let Ok(rpc_client) = RpcClient::new(blockchain_config.minerd_endpoint, ex.clone()).await + let Ok(rpc_client) = + RpcChadClient::new(blockchain_config.minerd_endpoint, ex.clone()).await else { error!(target: "darkfid", "Failed to initialize miner daemon rpc client, check if minerd is running"); return Err(Error::RpcClientStopped) diff --git a/bin/darkfid/src/rpc.rs b/bin/darkfid/src/rpc.rs index 7a2373693..e74fbf9cb 100644 --- a/bin/darkfid/src/rpc.rs +++ b/bin/darkfid/src/rpc.rs @@ -170,7 +170,7 @@ impl Darkfid { debug!(target: "darkfid::rpc::miner_daemon_request", "Executing request {} with params: {:?}", method, params); let latency = Instant::now(); let req = JsonRequest::new(method, params); - let rep = rpc_client.chad_request(req).await?; + let rep = rpc_client.request(req).await?; let latency = latency.elapsed(); debug!(target: "darkfid::rpc::miner_daemon_request", "Got reply: {:?}", rep); debug!(target: "darkfid::rpc::miner_daemon_request", "Latency: {:?}", latency);