Explorar el Código

darkfid: replaced RpcClient with RpcChadClient

skoupidi hace 2 años
padre
commit
dc6f4ecd6c
Se han modificado 2 ficheros con 6 adiciones y 5 borrados
  1. 5 4
      bin/darkfid/src/main.rs
  2. 1 1
      bin/darkfid/src/rpc.rs

+ 5 - 4
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<HashSet<StoppableTaskPtr>>,
     /// JSON-RPC client to execute requests to the miner daemon
-    rpc_client: Option<RpcClient>,
+    rpc_client: Option<RpcChadClient>,
 }
 
 impl Darkfid {
@@ -169,7 +169,7 @@ impl Darkfid {
         miners_p2p: Option<P2pPtr>,
         validator: ValidatorPtr,
         subscribers: HashMap<&'static str, JsonSubscriber>,
-        rpc_client: Option<RpcClient>,
+        rpc_client: Option<RpcChadClient>,
     ) -> Self {
         Self {
             sync_p2p,
@@ -248,7 +248,8 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> 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)

+ 1 - 1
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);