Skip to content

rpc: implement getaddednodeinfo#915

Closed
Micah-Shallom wants to merge 1 commit intogetfloresta:masterfrom
Micah-Shallom:feat/rpc-getaddednodeinfo
Closed

rpc: implement getaddednodeinfo#915
Micah-Shallom wants to merge 1 commit intogetfloresta:masterfrom
Micah-Shallom:feat/rpc-getaddednodeinfo

Conversation

@Micah-Shallom
Copy link
Copy Markdown
Contributor

@Micah-Shallom Micah-Shallom commented Mar 26, 2026

Summary

  • Implements the getaddednodeinfo RPC endpoint as listed in [RPCSAGA] Network RPCs, what we need ? #906
  • Returns information about peers that were manually added using the addnode RPC command
  • Supports an optional node parameter to filter results by a specific address
  • Reference: Bitcoin Core's getaddednodeinfo

Test plan

  • Functional test getaddednodeinfo.py — starts florestad + bitcoind, adds peer via addnode add, asserts correct response structure and filtering by IP
  • Manually tested on local regtest node
  • Clippy clean, fmt clean, build passes

Successful test run

image

RPC doc

image

Wire through the full RPC stack to expose information about
manually added peers (via addnode add), matching Bitcoin Core's
getaddednodeinfo behavior.

Layers touched:
- UserRequest/NodeResponse enums and NodeInterface method
- Handler in perform_user_request with filter_map logic
- FlorestaRPC trait + JsonRPCClient impl
- Server dispatcher + RpcImpl method
- CLI command with doc binding
- RPC doc, integration test, and test framework client method
Copy link
Copy Markdown
Collaborator

@csgui csgui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Micah-Shallom !

Thanks, but can you please clarify the extent of LLM usage in this PR?

@Micah-Shallom
Copy link
Copy Markdown
Contributor Author

Hi @csgui thank for the heads up ....i used AI to help setup the tests and doc template....the RPC implementation itself follows the same pattern as the existing endpoints i have been working on lately.

@csgui
Copy link
Copy Markdown
Collaborator

csgui commented Mar 27, 2026

@Micah-Shallom I’m asking because this PR comes across as somewhat mechanical.

As reviewers, we value understanding the contributor’s workflow, how you arrived at the proposed solution, including any iterations or mistakes along the way. Ideally, commits should read like a conversation, helping us follow the reasoning behind the changes. Our goal is to foster technical discussion around both the project and its implementation.

Every PR requires careful review, and feedback on AI-generated code can end up becoming just another input to the AI, which may not be the most effective use of everyone's time. Ultimately, we aim for a process that benefits both sides: reviewers learn from contributors and contributors deepen their understanding of the project. In that sense, a PR review should be a moment of knowledge sharing.

Because of this, PRs that appear heavily AI-generated tend to be a lower priority for the team and may not be accepted into the main codebase. Our main goal is to encourage knowledge sharing, discussion and clear technical storytelling about how a problem is solved, making the process a win-win for everyone involved.

@Micah-Shallom
Copy link
Copy Markdown
Contributor Author

Thanks for your feedback @csgui .... I'll keep this in mind going forward

@csgui
Copy link
Copy Markdown
Collaborator

csgui commented Mar 27, 2026

Issue #906 is already closed.

If there isn't a specific open issue related to what the PR addresses, please open one and reference it here. This is especially useful for RPC work.

@csgui
Copy link
Copy Markdown
Collaborator

csgui commented Mar 27, 2026

i used AI to help setup the tests and doc template...

Tests should be done manually, especially. This is where most of the thinking should happen, creating a safety net for the changes you're proposing to the codebase. Also, AI isn't very good at identifying subtle corner cases (at least not so far).

/// Information about a manually added peer, as returned by `getaddednodeinfo`.
pub struct AddedNodeInfoItem {
/// The address of the added node in `ip:port` format.
pub addednode: String,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

floresta’s RPCs need to be as close as possible to the core standard, so here it’s just the ip from core without the port

https://bitcoincore.org/en/doc/30.0.0/rpc/network/getaddednodeinfo/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks...this will be addressed on PR #916

@moisesPompilio moisesPompilio self-requested a review April 2, 2026 14:11

## Notes

- Only nodes added via `addnode add` are listed. Nodes connected with `addnode onetry` are not included.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this information is wrong based on the code I saw. It would be useful to demonstrate this in the Python test, since this is a rule for this RPC that must be followed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moisesPompilio thanks for your feedbacks... the way getaddednodeinfo was implemented here was such that it reads from added_pairs ...thats the reason onetry peers won't appear...cus handle_addnode_onetry_peer never adds to added_peers
image

@jaoleal opened a PR with this implementation there and we decided to use that...your reviews there too will be highly appreciated...

@jaoleal
Copy link
Copy Markdown
Member

jaoleal commented Apr 2, 2026

Sorry @Micah-Shallom but complementing on #915 (comment) before this goes any further.

Can we continue the implementation of this rpc on #916 ? I really could use a PR review there

@Micah-Shallom
Copy link
Copy Markdown
Contributor Author

okay @jaoleal your PR looks solid..lets continue the work there...i will do some more reviews on it...thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants