rpcclient: implement getaddressinfo command #1633
Merged
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.
Fields such as
label
, andlabels->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 atxscript.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.