Skip to content

Commit

Permalink
Revert "Resolve JSON RPC 2.0 non-compliance (#3209)" (#3212)
Browse files Browse the repository at this point in the history
This reverts commit 1527802.
  • Loading branch information
quentinlesceller authored Jan 28, 2020
1 parent 1527802 commit 83a2649
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions servers/src/mining/stratumserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,17 @@ type Tx = mpsc::UnboundedSender<String>;
// http://www.jsonrpc.org/specification
// RPC Methods

/// Represents a compliant JSON RPC 2.0 id.
/// Valid id: Integer, String.
#[derive(Serialize, Deserialize, Debug)]
enum JsonId {
NumId(u32),
StrId(String),
}

#[derive(Serialize, Deserialize, Debug)]
struct RpcRequest {
id: JsonId,
id: String,
jsonrpc: String,
method: String,
params: Option<Value>,
}

#[derive(Serialize, Deserialize, Debug)]
struct RpcResponse {
id: JsonId,
id: String,
jsonrpc: String,
method: String,
result: Option<Value>,
Expand Down Expand Up @@ -509,7 +501,7 @@ impl Handler {
// Issue #1159 - use a serde_json Value type to avoid extra quoting
let job_template_value: Value = serde_json::from_str(&job_template_json).unwrap();
let job_request = RpcRequest {
id: JsonId::StrId(String::from("Stratum")),
id: String::from("Stratum"),
jsonrpc: String::from("2.0"),
method: String::from("job"),
params: Some(job_template_value),
Expand Down

0 comments on commit 83a2649

Please sign in to comment.