cuprate_test_utils ::rpc ::data ::json Constant SYNC_INFO_RESPONSE Copy item path Source pub const SYNC_INFO_RESPONSE: &str = r#"{
"id": "0",
"jsonrpc": "2.0",
"result": {
"credits": 0,
"height": 3195157,
"next_needed_pruning_seed": 0,
"overview": "[]",
"peers": [{
"info": {
"address": "142.93.128.65:44986",
"address_type": 1,
"avg_download": 1,
"avg_upload": 1,
"connection_id": "a5803c4c2dac49e7b201dccdef54c862",
"current_download": 2,
"current_upload": 1,
"height": 3195157,
"host": "142.93.128.65",
"incoming": true,
"ip": "142.93.128.65",
"live_time": 18,
"local_ip": false,
"localhost": false,
"peer_id": "6830e9764d3e5687",
"port": "44986",
"pruning_seed": 0,
"recv_count": 20340,
"recv_idle_time": 0,
"rpc_credits_per_hash": 0,
"rpc_port": 18089,
"send_count": 32235,
"send_idle_time": 6,
"state": "normal",
"support_flags": 1
}
},{
"info": {
"address": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083",
"address_type": 4,
"avg_download": 0,
"avg_upload": 0,
"connection_id": "277f7c821bc546878c8bd29977e780f5",
"current_download": 0,
"current_upload": 0,
"height": 3195157,
"host": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion",
"incoming": false,
"ip": "",
"live_time": 2246,
"local_ip": false,
"localhost": false,
"peer_id": "0000000000000001",
"port": "",
"pruning_seed": 389,
"recv_count": 65164,
"recv_idle_time": 15,
"rpc_credits_per_hash": 0,
"rpc_port": 0,
"send_count": 99120,
"send_idle_time": 15,
"state": "normal",
"support_flags": 0
}
}],
"status": "OK",
"target_height": 0,
"top_hash": "",
"untrusted": false
}
}"#;
Expand description Documentation , request .
use cuprate_test_utils::rpc::data::json::* ;
use serde_json::{to_value, Value};
let value = serde_json::from_str::<Value>(& SYNC_INFO_RESPONSE).unwrap();
let Value::Object(map) = value else {
panic! ();
};
assert_eq! (map.get("jsonrpc" ).unwrap(), "2.0" );
map.get("id" ).unwrap();
if map.get("method" ).is_some() {
return ;
}
if map.get("result" ).is_none() {
map.get("error" ).unwrap();
}