|
| 1 | +// SPDX-License-Identifier: CC0-1.0 |
| 2 | + |
| 3 | +//! The JSON-RPC API for Bitcoin Core `v26` - hidden. |
| 4 | +//! |
| 5 | +//! Types for methods that are excluded from the API docs by default. |
| 6 | +
|
| 7 | +use alloc::collections::BTreeMap; |
| 8 | + |
| 9 | +use serde::{Deserialize, Serialize}; |
| 10 | + |
| 11 | +/// Result of JSON-RPC method `getrawaddrman`. |
| 12 | +/// |
| 13 | +/// > getrawaddrman |
| 14 | +/// > |
| 15 | +/// > EXPERIMENTAL warning: this call may be changed in future releases. |
| 16 | +/// > |
| 17 | +/// > Returns information on all address manager entries for the new and tried tables. |
| 18 | +/// |
| 19 | +/// This is a hidden RPC, useful for testing and development. |
| 20 | +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] |
| 21 | +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] |
| 22 | +pub struct GetRawAddrMan { |
| 23 | + /// Addresses in the "new" table (potential peers discovered but not yet connected to). |
| 24 | + pub new: BTreeMap<String, RawAddrManEntry>, |
| 25 | + /// Addresses in the "tried" table (peers successfully connected to in the past). |
| 26 | + pub tried: BTreeMap<String, RawAddrManEntry>, |
| 27 | +} |
| 28 | + |
| 29 | +/// An entry in the address manager table. Part of `getrawaddrman`. |
| 30 | +/// |
| 31 | +/// The key in the parent map is formatted as "bucket/position" indicating the |
| 32 | +/// location in the relevant address manager table. |
| 33 | +/// |
| 34 | +/// Field order matches Bitcoin Core's RPC response definition. |
| 35 | +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] |
| 36 | +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] |
| 37 | +pub struct RawAddrManEntry { |
| 38 | + /// The address of the node. |
| 39 | + pub address: String, |
| 40 | + /// The port number of the node. |
| 41 | + pub port: u16, |
| 42 | + /// The network (ipv4, ipv6, onion, i2p, cjdns) of the address. |
| 43 | + pub network: String, |
| 44 | + /// The services offered by the node. |
| 45 | + pub services: u64, |
| 46 | + /// The UNIX epoch time when the node was last seen. |
| 47 | + pub time: i64, |
| 48 | + /// The address that relayed the address to us. |
| 49 | + pub source: String, |
| 50 | + /// The network (ipv4, ipv6, onion, i2p, cjdns) of the source address. |
| 51 | + pub source_network: String, |
| 52 | +} |
0 commit comments