-
Notifications
You must be signed in to change notification settings - Fork 38.7k
rpc: adjust incorrect RPCHelpMan types #21897
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The OBJ type is for actual objects with defined keys; OBJ_USER_KEYS is for objects with user-defined keys (such as the bitcoin address(es) in the createrawtransaction output object.
ARR_FIXED is for cases like this, where the elements are in an array for convenience, rather than due to being dynamically sized lists.
Member
|
Nice find. Rendered diff: diff --git a/createrawtransaction b/createrawtransaction
index b488df3..cd68d55 100644
--- a/createrawtransaction
+++ b/createrawtransaction
@@ -1,4 +1,4 @@
-createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable )
+createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount,...},{"data":"hex"},...] ( locktime replaceable )
Create a transaction spending the given inputs and creating new outputs.
Outputs can be addresses or data.
@@ -23,6 +23,7 @@ Arguments:
[
{ (json object)
"address": amount, (numeric or string, required) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC
+ ...
},
{ (json object)
"data": "hex", (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
diff --git a/listaddressgroupings b/listaddressgroupings
index 860fe09..552faaa 100644
--- a/listaddressgroupings
+++ b/listaddressgroupings
@@ -10,8 +10,7 @@ Result:
[ (json array)
"str", (string) The bitcoin address
n, (numeric) The amount in BTC
- "str", (string, optional) The label
- ...
+ "str" (string, optional) The label
],
...
], |
Member
|
ACK 7031721 🐀 Show signature and timestampSignature: Timestamp of file with hash |
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
May 10, 2021
7031721 rpc/listaddressgroupings: redefine inner-most array as ARR_FIXED (Karl-Johan Alm) 8500f7b rpc/createrawtransaction: redefine addresses as OBJ_USER_KEYS (Karl-Johan Alm) d9e2183 rpc: include OBJ_USER_KEY in RPCArg constructor checks (Karl-Johan Alm) Pull request description: This PR adjusts the two issues I encountered while developing a tool that converts RPCHelpMan objects into bindings for other language(s). The first is in createrawtransaction, where the address part, e.g. bc1qabc in > createrawtransaction '[]' '[{"bc1qabc": 1.0}]' is declared as a `Type::OBJ`, when in reality it should be a `Type::OBJ_USER_KEYS`, defined as such: https://github.com/bitcoin/bitcoin/blob/5925f1e652768a9502831b9ccf78d16cf3c37d29/src/rpc/util.h#L126 (coincidentally, this is the first and only (afaict) usage of this `RPCArg::Type`). The second is in the `listaddressgroupings` RPC, which returns an array of arrays of arrays, where the innermost one is a tuple-thingie with an optional 3rd item; this is an `ARR_FIXED`, not an `ARR`. ACKs for top commit: MarcoFalke: ACK 7031721 🐀 Tree-SHA512: 769377416c6226d1738a956fb685498e009f9e7eb2d45bc679b81c5364b9520fdbcb49392c937ab45598aa0d33589e8e6a59ccc101cf8d8e7dfdafd58d4eefd0
Merged
maflcko
pushed a commit
to maflcko/bitcoin-core
that referenced
this pull request
May 20, 2021
6e2eb0d rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) (Karl-Johan Alm) 4983f4c rpc/createwallet: omitted named arguments (Karl-Johan Alm) dc4db23 rpc: address:amount dictionaries are OBJ_USER_KEYS (Karl-Johan Alm) c8cf0a3 rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary (Karl-Johan Alm) eb4fb7e rpc/gettxoutsetinfo: hash_or_height is a named argument (Karl-Johan Alm) Pull request description: This is a follow-up to bitcoin#21897, and I believe covers the remaining cases, at least that I could find. Edited to remove unrelated information about a side project. ACKs for top commit: laanwj: Documentation diff ACK 6e2eb0d promag: Code review ACK 6e2eb0d. Tree-SHA512: d26f6e074e13d64bbca2a114a0adc7f905d47d238c4e9bc49f70ca0b775afbebf9879fc3794ab29dc316a6dbd00ba8cbeb01197e236ee4ab2e9854db25f23f04
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
May 20, 2021
6e2eb0d rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) (Karl-Johan Alm) 4983f4c rpc/createwallet: omitted named arguments (Karl-Johan Alm) dc4db23 rpc: address:amount dictionaries are OBJ_USER_KEYS (Karl-Johan Alm) c8cf0a3 rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary (Karl-Johan Alm) eb4fb7e rpc/gettxoutsetinfo: hash_or_height is a named argument (Karl-Johan Alm) Pull request description: This is a follow-up to bitcoin#21897, and I believe covers the remaining cases, at least that I could find. Edited to remove unrelated information about a side project. ACKs for top commit: laanwj: Documentation diff ACK 6e2eb0d promag: Code review ACK 6e2eb0d. Tree-SHA512: d26f6e074e13d64bbca2a114a0adc7f905d47d238c4e9bc49f70ca0b775afbebf9879fc3794ab29dc316a6dbd00ba8cbeb01197e236ee4ab2e9854db25f23f04
gwillen
pushed a commit
to ElementsProject/elements
that referenced
this pull request
Jun 1, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR adjusts the two issues I encountered while developing a tool that converts RPCHelpMan objects into bindings for other language(s).
The first is in createrawtransaction, where the address part, e.g. bc1qabc in
is declared as a
Type::OBJ, when in reality it should be aType::OBJ_USER_KEYS, defined as such:bitcoin/src/rpc/util.h
Line 126 in 5925f1e
(coincidentally, this is the first and only (afaict) usage of this
RPCArg::Type).The second is in the
listaddressgroupingsRPC, which returns an array of arrays of arrays, where the innermost one is a tuple-thingie with an optional 3rd item; this is anARR_FIXED, not anARR.