Skip to content
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

rpcclient: implement getaddressinfo command #1633

Merged
merged 1 commit into from
Sep 21, 2020

Conversation

onyb
Copy link
Contributor

@onyb onyb commented Sep 15, 2020

Docs getaddressinfo

Fields such as label, and labels->purpose are not included, since they are deprecated, and will be removed in Bitcoin Core 0.21.

Most of the fields in the results struct are repeated in the embedded field if (for example) the address itself is a script embedding another address. To have minimal code duplication, I have factored them out to a private struct.

Another noteworthy thing in this PR is the custom unmarshalling I did to support loading a script to a txscript.ScriptClass, without duplicating the entire struct with raw fields. I learnt about this technique in this article if you want to read.

Tested locally with Bitcoin Core v0.20.1. See rpcclient/example_test.go for details.

Fields such as label, and labelspurpose are not included, since they
are deprecated, and will be removed in Bitcoin Core 0.21.
@onyb onyb added the rpc label Sep 15, 2020
@onyb onyb added this to the 0.22.0 milestone Sep 15, 2020
@coveralls
Copy link

coveralls commented Sep 15, 2020

Pull Request Test Coverage Report for Build 256438448

  • 58 of 80 (72.5%) changed or added relevant lines in 4 files are covered.
  • 7 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.7%) to 53.587%

Changes Missing Coverage Covered Lines Changed/Added Lines %
btcjson/walletsvrresults.go 45 49 91.84%
rpcclient/wallet.go 0 18 0.0%
Files with Coverage Reduction New Missed Lines %
peer/peer.go 3 75.39%
database/ffldb/blockio.go 4 92.62%
Totals Coverage Status
Change from base Build 253997810: 0.7%
Covered Lines: 20713
Relevant Lines: 38653

💛 - Coveralls

Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

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

OK

@jcvernaleo jcvernaleo merged commit ac3f235 into btcsuite:master Sep 21, 2020
@onyb onyb deleted the getaddressinfo branch September 21, 2020 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants