mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
Revert "bin/tau: add some saftey checks"
This reverts commit 6f5bf9fb41.
This commit is contained in:
@@ -4,11 +4,7 @@ use serde_json::{json, Value};
|
||||
|
||||
use darkfi::{util::Timestamp, Error};
|
||||
|
||||
use crate::{
|
||||
error::{TaudError, TaudResult},
|
||||
task_info::TaskInfo,
|
||||
JsonRpcInterface,
|
||||
};
|
||||
use crate::{error::TaudResult, task_info::TaskInfo, JsonRpcInterface};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
struct BaseTaskInfo {
|
||||
@@ -38,11 +34,6 @@ impl JsonRpcInterface {
|
||||
// <-- {"jsonrpc": "2.0", "result": true, "id": 1}
|
||||
pub async fn add(&self, params: Value) -> TaudResult<Value> {
|
||||
debug!(target: "tau", "JsonRpc::add() params {}", params);
|
||||
|
||||
if !params.is_array() {
|
||||
return Err(TaudError::InvalidData("params is not an array".into()))
|
||||
}
|
||||
|
||||
let args = params.as_array().unwrap();
|
||||
|
||||
let task: BaseTaskInfo = serde_json::from_value(args[0].clone())?;
|
||||
|
||||
@@ -26,11 +26,6 @@ impl JsonRpcInterface {
|
||||
// <-- {"jsonrpc": "2.0", "result": "task", "id": 1}
|
||||
pub async fn get_task_by_id(&self, params: Value) -> TaudResult<Value> {
|
||||
debug!(target: "tau", "JsonRpc::get_task_by_id() params {}", params);
|
||||
|
||||
if !params.is_array() {
|
||||
return Err(TaudError::InvalidData("params is not an array".into()))
|
||||
}
|
||||
|
||||
let args = params.as_array().unwrap();
|
||||
|
||||
if args.len() != 1 {
|
||||
|
||||
@@ -16,11 +16,6 @@ impl JsonRpcInterface {
|
||||
// <-- {"jsonrpc": "2.0", "result": true, "id": 1}
|
||||
pub async fn update(&self, params: Value) -> TaudResult<Value> {
|
||||
debug!(target: "tau", "JsonRpc::update() params {}", params);
|
||||
|
||||
if !params.is_array() {
|
||||
return Err(TaudError::InvalidData("params is not an array".into()))
|
||||
}
|
||||
|
||||
let args = params.as_array().unwrap();
|
||||
|
||||
if args.len() != 2 {
|
||||
@@ -42,11 +37,6 @@ impl JsonRpcInterface {
|
||||
// TODO: BUG: Validate that the state string is correct and not something arbitrary
|
||||
|
||||
debug!(target: "tau", "JsonRpc::set_state() params {}", params);
|
||||
|
||||
if !params.is_array() {
|
||||
return Err(TaudError::InvalidData("params is not an array".into()))
|
||||
}
|
||||
|
||||
let args = params.as_array().unwrap();
|
||||
|
||||
if args.len() != 2 {
|
||||
@@ -69,11 +59,6 @@ impl JsonRpcInterface {
|
||||
// <-- {"jsonrpc": "2.0", "result": true, "id": 1}
|
||||
pub async fn set_comment(&self, params: Value) -> TaudResult<Value> {
|
||||
debug!(target: "tau", "JsonRpc::set_comment() params {}", params);
|
||||
|
||||
if !params.is_array() {
|
||||
return Err(TaudError::InvalidData("params is not an array".into()))
|
||||
}
|
||||
|
||||
let args = params.as_array().unwrap();
|
||||
|
||||
if args.len() != 2 {
|
||||
|
||||
Reference in New Issue
Block a user