diff --git a/bin/darkfi-mmproxy/src/stratum.rs b/bin/darkfi-mmproxy/src/stratum.rs index 74a91f9ffa97..c2bfdcf444de 100644 --- a/bin/darkfi-mmproxy/src/stratum.rs +++ b/bin/darkfi-mmproxy/src/stratum.rs @@ -98,6 +98,37 @@ impl MiningProxy { } pub async fn stratum_submit(&self, id: u16, params: JsonValue) -> JsonResult { + let params = params.get::>().unwrap(); + if params.len() != 1 || !params[0].is_object() { + return JsonError::new(ErrorCode::InvalidParams, None, id).into() + } + + let params = params[0].get::>().unwrap(); + + if !params.contains_key("id") || + !params.contains_key("job_id") || + !params.contains_key("nonce") || + !params.contains_key("result") + { + return JsonError::new(ErrorCode::InvalidParams, None, id).into() + } + + let Some(uuid) = params["id"].get::() else { + return JsonError::new(ErrorCode::InvalidParams, None, id).into() + }; + + let Some(job_id) = params["job_id"].get::() else { + return JsonError::new(ErrorCode::InvalidParams, None, id).into() + }; + + let Some(nonce) = params["nonce"].get::() else { + return JsonError::new(ErrorCode::InvalidParams, None, id).into() + }; + + let Some(result) = params["result"].get::() else { + return JsonError::new(ErrorCode::InvalidParams, None, id).into() + }; + todo!() }