mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
Chain type field (#3790)
* Adding chain type field into get_status rpc * formatting
This commit is contained in:
parent
9a23cfe483
commit
01b25650e2
3 changed files with 6 additions and 1 deletions
|
@ -49,6 +49,7 @@ pub trait OwnerRpc: Sync + Send {
|
|||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"Ok": {
|
||||
"chain": "main",
|
||||
"protocol_version": "2",
|
||||
"user_agent": "MW/Grin 2.x.x",
|
||||
"connections": "8",
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::chain;
|
|||
use crate::core::core::hash::Hashed;
|
||||
use crate::core::core::merkle_proof::MerkleProof;
|
||||
use crate::core::core::{FeeFields, KernelFeatures, TxKernel};
|
||||
use crate::core::{core, ser};
|
||||
use crate::core::{core, global, ser};
|
||||
use crate::p2p;
|
||||
use crate::util::secp::pedersen;
|
||||
use crate::util::{self, ToHex};
|
||||
|
@ -68,6 +68,8 @@ impl Tip {
|
|||
/// Status page containing different server information
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Status {
|
||||
// The chain type
|
||||
pub chain: String,
|
||||
// The protocol version
|
||||
pub protocol_version: u32,
|
||||
// The user user agent
|
||||
|
@ -91,6 +93,7 @@ impl Status {
|
|||
sync_info: Option<serde_json::Value>,
|
||||
) -> Status {
|
||||
Status {
|
||||
chain: global::get_chain_type().shortname(),
|
||||
protocol_version: ser::ProtocolVersion::local().into(),
|
||||
user_agent: p2p::msg::USER_AGENT.to_string(),
|
||||
connections: connections,
|
||||
|
|
|
@ -92,6 +92,7 @@ impl HTTPNodeClient {
|
|||
t.reset().unwrap();
|
||||
match self.send_json_request::<Status>("get_status", &serde_json::Value::Null) {
|
||||
Ok(status) => {
|
||||
writeln!(e, "Chain type: {}", status.chain).unwrap();
|
||||
writeln!(e, "Protocol version: {:?}", status.protocol_version).unwrap();
|
||||
writeln!(e, "User agent: {}", status.user_agent).unwrap();
|
||||
writeln!(e, "Connections: {}", status.connections).unwrap();
|
||||
|
|
Loading…
Reference in a new issue