-
Notifications
You must be signed in to change notification settings - Fork 810
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
validateaddress and getaddressinfo RPC Update #731
Conversation
This comment has been minimized.
This comment has been minimized.
Updated the |
Looks good, a few minor nits. It's good to resolve those values from being hardcoded and sometimes incorrect values.The watchonly is defined by the wallet in bcoin, so the per address check doesn't completely map over, however good to have the value be correct. |
I also get an |
updates validateaddress to match the changes in bitcoind bitcoin/bitcoin#10583. removes the fields ismine and iswatchonly, those are things that a wallet would know, not a node. adds segwit related fields, witness_version and witness_program. test changes to the node rpc method validateaddress with p2pkh, p2sh, p2wpkh and p2wsh addresses
a42580f
to
2119591
Compare
update the rpc command to better match bitcoind. add the ismine and iswatchonly fields and segwit related fields such as witness_version and witness_program.
2119591
to
2b7c827
Compare
2b7c827
to
6850a32
Compare
validateaddress and getaddressinfo RPC Update
Adds a new wallet RPC method getaddressinfo that corresponds to changes with bitcoind. Returns values: - address - ismine - iswatchonly - ischange - isspendable - isscript - witness_version - witness_program The ismine property previously existed on the node RPC method validateaddress which was always hardcoded to true. An additional PR will be added to update validateaddress to remove the ismine property. isspendable refers to an address with null data, of version 31. See PR in bcoin: bcoin-org/bcoin#731 See bitcoind docs: https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/getaddressinfo/
This PR updates the node rpc validateaddress to better seperate the wallet and the node. The rpc was returning ismine and iswatch only. These values were moved to the wallet rpc method getaddressinfo. This corresponds to a change in bitcoind and bcoin. The updated validateaddress rpc returns the values: - isvalid - address - ismine - iswatchonly - isscript - isspendable - witness_version - witness_program See PR in bcoin: bcoin-org/bcoin#731 See PR in bitcoind: bitcoin/bitcoin#10583
This PR updates the node rpc validateaddress to better seperate the wallet and the node. The rpc was returning ismine and iswatch only. These values were moved to the wallet rpc method getaddressinfo. This corresponds to a change in bitcoind and bcoin. The updated validateaddress rpc returns the values: - isvalid - address - ismine - iswatchonly - isscript - isspendable - witness_version - witness_program See PR in bcoin: bcoin-org/bcoin#731 See PR in bitcoind: bitcoin/bitcoin#10583
Adds a new wallet RPC method getaddressinfo that corresponds to changes with bitcoind. Returns values: - address - ismine - iswatchonly - ischange - isspendable - isscript - witness_version - witness_program The ismine property previously existed on the node RPC method validateaddress which was always hardcoded to true. An additional PR will be added to update validateaddress to remove the ismine property. isspendable refers to an address with null data, of version 31. See PR in bcoin: bcoin-org/bcoin#731 See bitcoind docs: https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/getaddressinfo/
Adds a new wallet RPC method getaddressinfo that corresponds to changes with bitcoind. Returns values: - address - ismine - iswatchonly - ischange - isspendable - isscript - witness_version - witness_program The ismine property previously existed on the node RPC method validateaddress which was always hardcoded to true. An additional PR will be added to update validateaddress to remove the ismine property. isspendable refers to an address with null data, of version 31. See PR in bcoin: bcoin-org/bcoin#731 See bitcoind docs: https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/getaddressinfo/
Adds a new wallet RPC method getaddressinfo that corresponds to changes with bitcoind. Returns values: - address - ismine - iswatchonly - ischange - isspendable - isscript - witness_version - witness_program The ismine property previously existed on the node RPC method validateaddress which was always hardcoded to true. Commit 62b4de5 updates `validateaddress` to remove the `ismine` property because that property can now be found on the `getaddressinfo` RPC. The `isspendable` property refers to an address will null data, which is version 31. See PR in bcoin: bcoin-org/bcoin#731 See bitcoind docs: https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/getaddressinfo/
Overview
Update the node rpc method
validateaddress
to match the latest bitcoind interface.The new interface is defined here: https://bitcoincore.org/en/doc/0.17.0/rpc/util/validateaddress/
Add the wallet rpc method
getaddressinfo
https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/getaddressinfo/
Notably, the properties
ismine
andiswatchonly
are moved togetaddressinfo
,which is a good thing because in bcoin,
validateaddress
had themhardcoded to
false
anyways, and we know of an exchange thatwas attempting to use the value
ismine
for integrations into their system.ismine
now properly returns the correct value for addresses thatfall into the lookahead
Tests are added for p2pkh, p2sh, p2wpkh and p2wsh. I don't love that I had
to add
undefined
keys to thenode-test.js
file, but theundefined
valuesare being included in the object and other tests in the same file have hardcoded
undefined
values as well. I think its because the objects aren't going over thewire so the
undefined
values aren't being removed from the objects whenthey get stringified
See changelog here: https://github.com/bitcoin/bitcoin/blob/53f26cd11dc04a0ab7a3ee72a3469050c4c2bc17/doc/release-notes/release-notes-0.17.0.md
See changes here: bitcoin/bitcoin#10583
Examples
Starting bitcoind with the command:
And starting bcoin with the command:
getaddressinfo
p2pkh
bitcoind
bcoin
p2sh
bitcoind
bcoin
p2wpkh
bitcoind
bcoin
p2wsh
bitcoind
bcoin
validateaddress
p2pkh
bitcoind
bcoin
p2sh
bitcoind
bcoin
p2wpkh
bitcoind
bcoin
p2wsh
bitcoind
bcoin