mirror of
https://github.com/romanz/electrs.git
synced 2025-02-24 15:02:21 +01:00
Log daemon's network info
(including its version string)
This commit is contained in:
parent
253e244a86
commit
00de0c028c
1 changed files with 12 additions and 0 deletions
|
@ -75,6 +75,12 @@ pub struct BlockchainInfo {
|
|||
pruned: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct NetworkInfo {
|
||||
version: u64,
|
||||
subversion: String,
|
||||
}
|
||||
|
||||
pub struct MempoolEntry {
|
||||
fee: u64, // in satoshis
|
||||
vsize: u32, // in virtual bytes (= weight/4)
|
||||
|
@ -210,6 +216,7 @@ impl Daemon {
|
|||
),
|
||||
};
|
||||
debug!("{:?}", daemon.getblockchaininfo()?);
|
||||
debug!("{:?}", daemon.getnetworkinfo()?);
|
||||
Ok(daemon)
|
||||
}
|
||||
|
||||
|
@ -287,6 +294,11 @@ impl Daemon {
|
|||
Ok(from_value(info).chain_err(|| "invalid blockchain info")?)
|
||||
}
|
||||
|
||||
pub fn getnetworkinfo(&self) -> Result<NetworkInfo> {
|
||||
let info: Value = self.request("getnetworkinfo", json!([]))?;
|
||||
Ok(from_value(info).chain_err(|| "invalid network info")?)
|
||||
}
|
||||
|
||||
pub fn getbestblockhash(&self) -> Result<Sha256dHash> {
|
||||
parse_hash(&self.request("getbestblockhash", json!([]))?).chain_err(|| "invalid blockhash")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue