Skip to content

Fix getnodeaddresses test - #334

Merged
tcharding merged 4 commits into
rust-bitcoin:masterfrom
jamillambert:0819-getnodeaddresses-test
Aug 20, 2025
Merged

tcharding merged 4 commits into
rust-bitcoin:masterfrom
jamillambert:0819-getnodeaddresses-test

Conversation

@jamillambert

Copy link
Copy Markdown
Collaborator

The return shape of the RPC is not tested since an empty list is returned.

  • Add the hidden RPC addpeeraddress in v21 in a new module called hidden.

  • In the getnodeaddresses test use the hidden RPC addpeeraddress for v21 and later to add an address to the address manager table. Assert that the returned GetNodeAddresses contains the added peer address and port.

Closes #320

This RPC is excluded from Core documentation by default.

Add a new section `Hidden` including a module in `types`.

Create the struct and client macro.
@jamillambert
jamillambert force-pushed the 0819-getnodeaddresses-test branch 3 times, most recently from 404638a to 8d40dbe Compare August 19, 2025 17:41
`getnodeaddresses` was updated in v22 not v27.

Move the redefinition to v22 and update the reexports.
@jamillambert
jamillambert force-pushed the 0819-getnodeaddresses-test branch from 8d40dbe to b906ea7 Compare August 19, 2025 17:44
@jamillambert

Copy link
Copy Markdown
Collaborator Author

Thanks to @0xB10C for showing us how to fix this in the related issue.

@jamillambert
jamillambert force-pushed the 0819-getnodeaddresses-test branch from b906ea7 to c9cf940 Compare August 19, 2025 17:50
The return shape of the RPC is not tested since an empty list is 
returned.

Use the hidden RPC `addpeeraddress` for v21 and later to add an address 
to the address manager table in the test.

Assert that the returned `GetNodeAddresses` contains the added peer 
address and port.
Reordering of the reexports only.
@jamillambert jamillambert mentioned this pull request Aug 19, 2025
5 of 12 tasks

/// Implements Bitcoin Core JSON-RPC API method `addpeeraddress`.
#[macro_export]
macro_rules! impl_client_v21_add_peer_address {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
macro_rules! impl_client_v21_add_peer_address {
macro_rules! impl_client_v21__add_peer_address {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #335

@tcharding tcharding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK c9cf940

@tcharding
tcharding merged commit 42e808f into rust-bitcoin:master Aug 20, 2025
blaze-smith470pm added a commit to blaze-smith470pm/corepc that referenced this pull request Sep 26, 2025
c9cf9406ab355964ed1924b31f1bb7fc2a8a1a0f Run the formatter (Jamil Lambert, PhD)
5bdcdc8ce414ebacebce2805b76513c95881adb8 Fix getnodeaddresses test (Jamil Lambert, PhD)
8be0a12d742190a2ba0431534bd024f6adffa1bc Move getnodeaddresses redefinition from v27 to v22 (Jamil Lambert, PhD)
cfbba65c056d502b49e5397062278ff310c0df53 Add hidden RPC addpeeraddress to v21 (Jamil Lambert, PhD)

Pull request description:

  The return shape of the RPC is not tested since an empty list is returned.

  - Add the hidden RPC `addpeeraddress` in v21 in a new module called `hidden`.

  - In the `getnodeaddresses` test use the hidden RPC `addpeeraddress` for v21 and later to add an address to the address manager table. Assert that the returned `GetNodeAddresses` contains the added peer address and port.

  Closes #320

ACKs for top commit:
  tcharding:
    ACK c9cf9406ab355964ed1924b31f1bb7fc2a8a1a0f

Tree-SHA512: 42e51f6345b59ae8108a9a9624da8bdec1458d102eaf70548fc9eee8ad09db3b33ac1985e9617db49260f1cc09ef1a5d7fb469f7da218d0c6ca035947c796c96
deadmanoz added a commit to deadmanoz/corepc that referenced this pull request Dec 17, 2025
This RPC is excluded from Core documentation by default.

Add types and client macro in hidden modules following the pattern
from addpeeraddress (rust-bitcoin#334). Includes support for optional asmap fields
(mapped_as, source_mapped_as).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getnodeaddresses returns an empty list

2 participants