-
Notifications
You must be signed in to change notification settings - Fork 46
Add hidden RPC getrawaddrman
#439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
deadmanoz
wants to merge
1
commit into
rust-bitcoin:master
Choose a base branch
from
deadmanoz:implement-getrawaddrman
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // SPDX-License-Identifier: CC0-1.0 | ||
|
|
||
| //! Macros for implementing JSON-RPC methods on a client. | ||
| //! | ||
| //! Specifically this is `== Hidden ==` methods that are not listed in the | ||
| //! API docs of Bitcoin Core `v26`. | ||
| //! | ||
| //! All macros require `Client` to be in scope. | ||
| //! | ||
| //! See or use the `define_jsonrpc_bitreq_client!` macro to define a `Client`. | ||
|
|
||
| /// Implements Bitcoin Core JSON-RPC API method `getrawaddrman`. | ||
| #[macro_export] | ||
| macro_rules! impl_client_v26__get_raw_addrman { | ||
| () => { | ||
| impl Client { | ||
| pub fn get_raw_addrman(&self) -> Result<GetRawAddrMan> { | ||
| self.call("getrawaddrman", &[]) | ||
| } | ||
| } | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // SPDX-License-Identifier: CC0-1.0 | ||
|
|
||
| //! The JSON-RPC API for Bitcoin Core `v26` - hidden. | ||
| //! | ||
| //! Types for methods that are excluded from the API docs by default. | ||
|
|
||
| use alloc::collections::BTreeMap; | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| /// Result of JSON-RPC method `getrawaddrman`. | ||
| /// | ||
| /// > getrawaddrman | ||
| /// > | ||
| /// > EXPERIMENTAL warning: this call may be changed in future releases. | ||
| /// > | ||
| /// > Returns information on all address manager entries for the new and tried tables. | ||
| /// | ||
| /// This is a hidden RPC, useful for testing and development. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] | ||
| pub struct GetRawAddrMan { | ||
| /// Addresses in the "new" table (potential peers discovered but not yet connected to). | ||
| pub new: BTreeMap<String, RawAddrManEntry>, | ||
| /// Addresses in the "tried" table (peers successfully connected to in the past). | ||
| pub tried: BTreeMap<String, RawAddrManEntry>, | ||
| } | ||
|
|
||
| /// An entry in the address manager table. Part of `getrawaddrman`. | ||
| /// | ||
| /// The key in the parent map is formatted as "bucket/position" indicating the | ||
| /// location in the relevant address manager table. | ||
deadmanoz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// | ||
| /// Field order matches Bitcoin Core's RPC response definition. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] | ||
| pub struct RawAddrManEntry { | ||
| /// The address of the node. | ||
| pub address: String, | ||
| /// The port number of the node. | ||
| pub port: u16, | ||
| /// The network (ipv4, ipv6, onion, i2p, cjdns) of the address. | ||
| pub network: String, | ||
| /// The services offered by the node. | ||
| pub services: u64, | ||
| /// The UNIX epoch time when the node was last seen. | ||
| pub time: i64, | ||
| /// The address that relayed the address to us. | ||
| pub source: String, | ||
| /// The network (ipv4, ipv6, onion, i2p, cjdns) of the source address. | ||
| pub source_network: String, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // SPDX-License-Identifier: CC0-1.0 | ||
|
|
||
| //! The JSON-RPC API for Bitcoin Core `v28` - hidden. | ||
| //! | ||
| //! Types for methods that are excluded from the API docs by default. | ||
|
|
||
| use alloc::collections::BTreeMap; | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| /// Result of JSON-RPC method `getrawaddrman`. | ||
| /// | ||
| /// > getrawaddrman | ||
| /// > | ||
| /// > EXPERIMENTAL warning: this call may be changed in future releases. | ||
| /// > | ||
| /// > Returns information on all address manager entries for the new and tried tables. | ||
| /// | ||
| /// This is a hidden RPC, useful for testing and development. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] | ||
| pub struct GetRawAddrMan { | ||
| /// Addresses in the "new" table (potential peers discovered but not yet connected to). | ||
| pub new: BTreeMap<String, RawAddrManEntry>, | ||
| /// Addresses in the "tried" table (peers successfully connected to in the past). | ||
| pub tried: BTreeMap<String, RawAddrManEntry>, | ||
| } | ||
|
|
||
| /// An entry in the address manager table. Part of `getrawaddrman`. | ||
| /// | ||
| /// The key in the parent map is formatted as "bucket/position" indicating the | ||
| /// location in the relevant address manager table. | ||
| /// | ||
| /// Field order matches Bitcoin Core's RPC response definition. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] | ||
| pub struct RawAddrManEntry { | ||
| /// The address of the node. | ||
| pub address: String, | ||
| /// Mapped AS (Autonomous System) number at the end of the BGP route to the peer. | ||
| /// Only present if the -asmap config option is set. | ||
| pub mapped_as: Option<u32>, | ||
| /// The port number of the node. | ||
| pub port: u16, | ||
| /// The network (ipv4, ipv6, onion, i2p, cjdns) of the address. | ||
| pub network: String, | ||
| /// The services offered by the node. | ||
| pub services: u64, | ||
| /// The UNIX epoch time when the node was last seen. | ||
| pub time: i64, | ||
| /// The address that relayed the address to us. | ||
| pub source: String, | ||
| /// The network (ipv4, ipv6, onion, i2p, cjdns) of the source address. | ||
| pub source_network: String, | ||
| /// Mapped AS (Autonomous System) number at the end of the BGP route to the source. | ||
| /// Only present if the -asmap config option is set. | ||
| pub source_mapped_as: Option<u32>, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall what
sourceis set to when usingaddpeeraddress, but maybe that can be checked as well.