parazyd 2 лет назад
Родитель
Сommit
1fc0fafbf9
3 измененных файлов с 13 добавлено и 10 удалено
  1. 2 0
      bin/darkfi-mmproxy/src/main.rs
  2. 3 2
      bin/darkfi-mmproxy/src/monero.rs
  3. 8 8
      bin/darkfi-mmproxy/src/stratum.rs

+ 2 - 0
bin/darkfi-mmproxy/src/main.rs

@@ -146,6 +146,7 @@ impl RequestHandler for MiningProxy {
             "get_block_count" => self.monero_get_block_count(req.id, req.params).await,
             "get_block_count" => self.monero_get_block_count(req.id, req.params).await,
             "getblockcount" => self.monero_get_block_count(req.id, req.params).await,
             "getblockcount" => self.monero_get_block_count(req.id, req.params).await,
 
 
+            /*
             "on_get_block_hash" => self.monero_on_get_block_hash(req.id, req.params).await,
             "on_get_block_hash" => self.monero_on_get_block_hash(req.id, req.params).await,
             "get_block_template" => self.monero_get_block_template(req.id, req.params).await,
             "get_block_template" => self.monero_get_block_template(req.id, req.params).await,
             "submit_block" => self.monero_submit_block(req.id, req.params).await,
             "submit_block" => self.monero_submit_block(req.id, req.params).await,
@@ -176,6 +177,7 @@ impl RequestHandler for MiningProxy {
             "calc_pow" => self.monero_calc_pow(req.id, req.params).await,
             "calc_pow" => self.monero_calc_pow(req.id, req.params).await,
             "flush_cache" => self.monero_flush_cache(req.id, req.params).await,
             "flush_cache" => self.monero_flush_cache(req.id, req.params).await,
             "add_aux_pow" => self.monero_add_aux_pow(req.id, req.params).await,
             "add_aux_pow" => self.monero_add_aux_pow(req.id, req.params).await,
+            */
 
 
             _ => JsonError::new(ErrorCode::MethodNotFound, None, req.id).into(),
             _ => JsonError::new(ErrorCode::MethodNotFound, None, req.id).into(),
         }
         }

+ 3 - 2
bin/darkfi-mmproxy/src/monero.rs

@@ -21,12 +21,11 @@ use darkfi::rpc::{
     util::JsonValue,
     util::JsonValue,
 };
 };
 use log::{debug, error};
 use log::{debug, error};
-use surf::http::mime;
 
 
 use super::MiningProxy;
 use super::MiningProxy;
 
 
 impl MiningProxy {
 impl MiningProxy {
-    pub async fn monero_get_block_count(&self, id: u16, params: JsonValue) -> JsonResult {
+    pub async fn monero_get_block_count(&self, id: u16, _params: JsonValue) -> JsonResult {
         debug!(target: "rpc::monero", "get_block_count()");
         debug!(target: "rpc::monero", "get_block_count()");
 
 
         let req_body = JsonRequest::new("get_block_count", vec![].into()).stringify().unwrap();
         let req_body = JsonRequest::new("get_block_count", vec![].into()).stringify().unwrap();
@@ -73,6 +72,7 @@ impl MiningProxy {
         JsonResponse::new(response_json, id).into()
         JsonResponse::new(response_json, id).into()
     }
     }
 
 
+    /*
     pub async fn monero_on_get_block_hash(&self, id: u16, params: JsonValue) -> JsonResult {
     pub async fn monero_on_get_block_hash(&self, id: u16, params: JsonValue) -> JsonResult {
         todo!()
         todo!()
     }
     }
@@ -196,4 +196,5 @@ impl MiningProxy {
     pub async fn monero_add_aux_pow(&self, id: u16, params: JsonValue) -> JsonResult {
     pub async fn monero_add_aux_pow(&self, id: u16, params: JsonValue) -> JsonResult {
         todo!()
         todo!()
     }
     }
+    */
 }
 }

+ 8 - 8
bin/darkfi-mmproxy/src/stratum.rs

@@ -97,7 +97,7 @@ impl MiningProxy {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         };
         };
 
 
-        let Some(agent) = params["agent"].get::<String>() else {
+        let Some(_agent) = params["agent"].get::<String>() else {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         };
         };
 
 
@@ -166,7 +166,7 @@ impl MiningProxy {
 
 
         // Spawn background task
         // Spawn background task
         ka_task.start(
         ka_task.start(
-            Self::keepalive_task(self.workers.clone(), uuid.clone(), ka_recv),
+            Self::keepalive_task(self.workers.clone(), uuid, ka_recv),
             move |_| async move { debug!("keepalive_task for {} exited", uuid) },
             move |_| async move { debug!("keepalive_task for {} exited", uuid) },
             Error::DetachedTaskStopped,
             Error::DetachedTaskStopped,
             self.executor.clone(),
             self.executor.clone(),
@@ -175,7 +175,7 @@ impl MiningProxy {
         info!("Added worker {} ({})", login, uuid);
         info!("Added worker {} ({})", login, uuid);
 
 
         // TODO: Send current job
         // TODO: Send current job
-        return JsonResponse::new(
+        JsonResponse::new(
             JsonValue::Object(HashMap::from([(
             JsonValue::Object(HashMap::from([(
                 "status".to_string(),
                 "status".to_string(),
                 JsonValue::String("KEEPALIVED".to_string()),
                 JsonValue::String("KEEPALIVED".to_string()),
@@ -201,19 +201,19 @@ impl MiningProxy {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         }
         }
 
 
-        let Some(uuid) = params["id"].get::<String>() else {
+        let Some(_uuid) = params["id"].get::<String>() else {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         };
         };
 
 
-        let Some(job_id) = params["job_id"].get::<String>() else {
+        let Some(_job_id) = params["job_id"].get::<String>() else {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         };
         };
 
 
-        let Some(nonce) = params["nonce"].get::<String>() else {
+        let Some(_nonce) = params["nonce"].get::<String>() else {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         };
         };
 
 
-        let Some(result) = params["result"].get::<String>() else {
+        let Some(_result) = params["result"].get::<String>() else {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         };
         };
 
 
@@ -253,7 +253,7 @@ impl MiningProxy {
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
             return JsonError::new(ErrorCode::InvalidParams, None, id).into()
         }
         }
 
 
-        return JsonResponse::new(
+        JsonResponse::new(
             JsonValue::Object(HashMap::from([(
             JsonValue::Object(HashMap::from([(
                 "status".to_string(),
                 "status".to_string(),
                 JsonValue::String("KEEPALIVED".to_string()),
                 JsonValue::String("KEEPALIVED".to_string()),