Skip to content

Conversation

@w0xlt
Copy link
Contributor

@w0xlt w0xlt commented Sep 24, 2022

As far as I know, there is currently no way to retrieve all address book entries via RPC.
This functionality can be added by slightly modifying the getaddressesbylabel and making the label parameter optional.

PR:

./src/bitcoin-cli -regtest getaddressesbylabel
{
  "bcrt1q23d9qmeqrmdfazp79e5xavpgrzqmmtjf7k2p7u": {
    "label": "label03",
    "purpose": "receive"
  },
  "bcrt1pynqgl3mh8qmwj496nfg6ucxd8jw0wz3rz7jtf4s4v6e9zv6a4cnqdcl79k": {
    "label": "label02",
    "purpose": "receive"
  },
  "bcrt1pty99hxsx7trd53ul7lhl4ee82ggqslyq54mg5mte5wv8nfu7xxfqcf0pzz": {
    "label": "label01",
    "purpose": "receive"
  }
}

On master branch, it is not possible to run that RPC without passing a label parameter.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to do this, you should mention that if no label is supplied then all address book entry addresses are returned

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 37f809a. Thanks.

@luke-jr
Copy link
Member

luke-jr commented Sep 25, 2022

Concept ~0. Seems like a hack.

Code looks fine though.

@aureleoules
Copy link
Contributor

aureleoules commented Sep 26, 2022

Concept ACK but not sure about the approach. Would it be better to create a new RPC getaddresses with filters such as label, purpose, creation_date, watch_only, minconf, etc? Which would deprecate getaddressesbylabel.

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 28, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK aureleoules, rajarshimaitra, 1440000bytes

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26186 (rpc: Sanitize label name in various RPCs with tests by aureleoules)
  • #24897 ([Draft / POC] Silent Payments by w0xlt)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@aureleoules
Copy link
Contributor

Another approach would be to take a label * to list all addresses. This is a hack but it's already used for backwards compatibility in listtransactions.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@rajarshimaitra
Copy link
Contributor

Concept ACK. This is useful for various situations where a bunch of imported spks needs to be retrieved from the wallet. Maybe to compare with an external source and check if any new spks need to be imported into the watchlist. Previously it could be done by making redundant labels just for this call, but having this option to dump everything seems useful.

I will go through the code changes in more detail. Adding one simple, functional test to check the behavior will be helpful.

@ghost
Copy link

ghost commented Mar 27, 2023

Concept ACK

@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@achow101
Copy link
Member

The PR didn't seem to attract much attention in the past. Also, the issue seems not important enough right now to keep it sitting around idle in the list of open PRs.

Closing due to lack of interest.

@achow101 achow101 closed this Sep 20, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Sep 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants