Network RPCs: getaddednodeinfo, addpeeraddress, getnodedaddresses e getaddrmaninfo.#916
Open
jaoleal wants to merge 4 commits intogetfloresta:masterfrom
Open
Network RPCs: getaddednodeinfo, addpeeraddress, getnodedaddresses e getaddrmaninfo.#916jaoleal wants to merge 4 commits intogetfloresta:masterfrom
jaoleal wants to merge 4 commits intogetfloresta:masterfrom
Conversation
Add getaddednodeinfo RPC that returns information about manually added nodes, including whether each is currently connected. Cross-references added_peers with active peer connections. Includes integration test and Python RPC wrapper.
Add addpeeraddress RPC that manually adds a peer address to the address manager. Accepts address, port, and optional tried parameter. Constructs a LocalAddress with WITNESS|NETWORK_LIMITED services and pushes it to AddressMan. Also adds address_count() helper to AddressMan. Includes integration test and Python RPC wrapper.
Add getnodeaddresses RPC that returns known peer addresses from the address manager. Accepts an optional count parameter and optional network filter (ipv4, ipv6, onion, i2p, cjdns). Includes integration test and Python RPC wrapper.
Add getaddrmaninfo RPC that returns address manager statistics broken down by network type (ipv4, ipv6, cjdns). Each network reports total, new (untried), and tried address counts. Adds get_addrman_info() aggregation method to AddressMan. Includes integration test and Python RPC wrapper.
ea030cf to
9f84eb4
Compare
Member
|
Can you add a changelog to the PR description? |
Comment on lines
+126
to
+131
| pub(crate) async fn get_added_node_info(&self) -> Result<Vec<AddedNodeInfo>> { | ||
| self.node | ||
| .get_added_node_info() | ||
| .await | ||
| .map_err(|e| JsonRpcError::Node(e.to_string())) | ||
| } |
There was a problem hiding this comment.
Hi @jaoleal ..looking at the RPC docs for bitocoin core, https://bitcoincore.org/en/doc/30.0.0/rpc/network/getaddednodeinfo/ the rpc endpoint is meant to take the node address and return info for that address else it returns node information for all nodes...
Comment on lines
+360
to
+363
| "getaddednodeinfo" => state | ||
| .get_added_node_info() | ||
| .await | ||
| .map(|v| serde_json::to_value(v).unwrap()), |
There was a problem hiding this comment.
this should take something like let node = get_optional_field(¶ms, 0, "node", get_string)?;
| #[derive(Debug, Clone, Serialize)] | ||
| /// Information about a manually added node (via `addnode`). | ||
| pub struct AddedNodeInfo { | ||
| /// The address of the added node in "ip:port" format. |
There was a problem hiding this comment.
as @moisesPompilio raised , we need to have the RPCs as close as possible to the core standard which requires only IP without the port
Comment on lines
+151
to
156
| pub struct AddedNodeInfo { | ||
| /// The address of the added node in "ip:port" format. | ||
| pub addednode: String, | ||
| /// Whether we are currently connected to this node. | ||
| pub connected: bool, | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Description and Notes
These already had the needed subsystems and theyre pretty usefull.
How to verify the changes you have done?
Review the tests and propose exercise extensions whether it applies.