From c95a661f7f7761ffbc4c3ef4604e32b12fecb11f Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Tue, 9 Jul 2024 18:50:27 -0400 Subject: [PATCH] json: fix `on_get_block_hash`, `submit_block` --- rpc/types/src/json.rs | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/rpc/types/src/json.rs b/rpc/types/src/json.rs index b884b3c..b82c99e 100644 --- a/rpc/types/src/json.rs +++ b/rpc/types/src/json.rs @@ -137,14 +137,13 @@ define_request_and_response! { /// use serde_json::*; /// use cuprate_rpc_types::json::*; /// - /// let x = OnGetBlockHashResponse { block_hash: String::from("asdf") }; + /// let x = OnGetBlockHashResponse { result: String::from("asdf") }; /// let x = to_string(&x).unwrap(); - /// assert_eq!(x, "\"asdf\""); + /// assert_eq!(x, r#"{"result":"asdf"}"#); /// ``` - #[cfg_attr(feature = "serde", serde(transparent))] - #[repr(transparent)] Response { - block_hash: String, + /// This is a block hash. + result: String, } } @@ -153,18 +152,8 @@ define_request_and_response! { cc73fe71162d564ffda8e549b79a350bca53c454 => core_rpc_server_commands_defs.h => 1114..=1128, SubmitBlock, - /// ```rust - /// use serde_json::*; - /// use cuprate_rpc_types::json::*; - /// - /// let x = SubmitBlockRequest { block_id: String::from("asdf") }; - /// let x = to_string(&x).unwrap(); - /// assert_eq!(x, "\"asdf\""); - /// ``` - #[cfg_attr(feature = "serde", serde(transparent))] - #[repr(transparent)] Request { - block_id: String, + request: Vec, }, /// ```rust /// use serde_json::*; @@ -172,11 +161,10 @@ define_request_and_response! { /// /// let x = SubmitBlockResponse { status: String::from("asdf") }; /// let x = to_string(&x).unwrap(); - /// assert_eq!(x, "\"asdf\""); + /// assert_eq!(x, r#"{"status":"asdf"}"#); /// ``` - #[cfg_attr(feature = "serde", serde(transparent))] - #[repr(transparent)] Response { + /// This is a block hash. status: String, } }