From ab4ae77556909353773a5453a81533f89fa5dcb7 Mon Sep 17 00:00:00 2001 From: 0xb10c Date: Tue, 3 Oct 2023 10:53:03 +0200 Subject: [PATCH] add: support for getrawaddrman --- client/src/client.rs | 5 +++++ json/src/lib.rs | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/client/src/client.rs b/client/src/client.rs index 206668a0..4d977719 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -1223,6 +1223,11 @@ pub trait RpcApi: Sized { self.call("getnettotals", &[]) } + /// Returns the addresses in the nodes address manager tables. + fn get_raw_addrman(&self) -> Result { + self.call("getrawaddrman", &[]) + } + /// Returns the estimated network hashes per second based on the last n blocks. fn get_network_hash_ps(&self, nblocks: Option, height: Option) -> Result { let mut args = [opt_into_json(nblocks)?, opt_into_json(height)?]; diff --git a/json/src/lib.rs b/json/src/lib.rs index bc3468f4..752a11fc 100644 --- a/json/src/lib.rs +++ b/json/src/lib.rs @@ -2163,6 +2163,25 @@ impl<'a> serde::Serialize for PubKeyOrAddress<'a> { } } +type GetRawAddrmanResultKey = String; + +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] +pub struct GetRawAddrmanResult { + pub new: HashMap, + pub tried: HashMap, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] +pub struct GetRawAddrmanResultAddress { + pub address: String, + pub port: u16, + pub services: u64, + pub time: u32, + pub network: String, + pub source: String, + pub source_network: String, +} + // Custom deserializer functions. /// deserialize_hex_array_opt deserializes a vector of hex-encoded byte arrays.