Browse Source

Allow JSONRPC 'id' to be of any type

skip-invalid-blocks
Roman Zeyde 6 years ago
parent
commit
b77cd541d5
No known key found for this signature in database GPG Key ID: 87CAE5FA46917CBB
  1. 6
      src/rpc.rs

6
src/rpc.rs

@ -3,7 +3,7 @@ use bitcoin::consensus::encode::{deserialize, serialize};
use bitcoin::util::hash::Sha256dHash;
use error_chain::ChainedError;
use hex;
use serde_json::{from_str, Number, Value};
use serde_json::{from_str, Value};
use std::collections::HashMap;
use std::io::{BufRead, BufReader, Write};
use std::net::{Shutdown, SocketAddr, TcpListener, TcpStream};
@ -284,7 +284,7 @@ impl Connection {
"merkle" : merkle_vec}))
}
fn handle_command(&mut self, method: &str, params: &[Value], id: &Number) -> Result<Value> {
fn handle_command(&mut self, method: &str, params: &[Value], id: &Value) -> Result<Value> {
let timer = self
.stats
.latency
@ -395,7 +395,7 @@ impl Connection {
(
Some(&Value::String(ref method)),
&Value::Array(ref params),
Some(&Value::Number(ref id)),
Some(ref id),
) => self.handle_command(method, params, id)?,
_ => bail!("invalid command: {}", cmd),
};

Loading…
Cancel
Save