-
Notifications
You must be signed in to change notification settings - Fork 38.7k
RPC: Add universal options argument to listtransactions #22807
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
Conversation
|
I think #19762 is a better solution to the problem of supporting large numbers of optional arguments. #19762 allows options to be specified without having to quote JSON on the command line and provides a more natural calling interface for languages like python that support named arguments. Unlike this PR, it is fully generic and does not require adding and maintaining confusing backwards compatibility code inside individual RPC method implementations. #19762 can also be a foundation for supporting future usability improvements like being able to declare individual arguments keyword-only (only allowed to be passed by name and not position). |
|
Concept ACK
It's a good idea, but non-standard and IMO complimentary.
This would make sense if positional use was deprecated, which it is not (and should not be sabotaged by making poor parameter positions or options unavailable). |
luke-jr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK, a few minor nits
Great, review is welcome.
non-standard != not standardized The "args" parameter added by #19762 is documented, but not standardized, in the exact same way the "options" parameter added by this PR is documented, but not standardized
Complimentary to what? It is not complimentary to this PR. It is incompatible with this PR.
It makes sense in combination with #19762, period. |
I was wrong, |
aab6389 to
c2c53d9
Compare
|
Addressed review suggestions from @luke-jr. |
c2c53d9 to
3e8b4dd
Compare
|
Removed unnecessary extra blank line inside |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NACK 3e8b4dd220b2ddf8ae7f10808d529e4b09058180, why not just append options argument? Or in #19443 just append new arguments.
|
@promag That was initial way it was done, to add new positional arguments, see #14898. It was @luke-jr idea to add it instead in place of existing |
|
@kristapsk I think it's mixing 2 different things: add |
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure here, but previous reviews on questions like this and doc/developer-notes.md generally seemed to discourage mixing types / overloading:
- Try not to overload methods on argument type. E.g. don't make `getblock(true)`
and `getblock("hash")` do different things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's about supported use, not deprecation compatibility...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the old use be deprecated with planned removal then?
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
|
Could this be reopened? Will rebase. |
3e8b4dd to
29d9743
Compare
|
Rebased |
|
Note that #19762, which is mentioned in the early commentary on this PR, has now recently been merged. |
|
|
@MarcoFalke I cannot reproduce that compiler error. Try |
|
Did you run |
Ok, seeing error after rebase. Will look at this. |
29d9743 to
c739834
Compare
|
Rebased |
c739834 to
500010d
Compare
|
Rebased |
|
I think you'll still need to rebase and fix the compile error |
500010d to
7701d95
Compare
src/wallet/rpc/transactions.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wallet/rpc/transactions.cpp:441:75: error: no member named 'OMITTED_NAMED_ARG' in 'RPCArg::Optional'
{"options|skip", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "for backward compatibility: passing in a number instead of an object will result in {\"skip\":nnn}",
~~~~~~~~~~~~~~~~~~^
wallet/rpc/transactions.cpp:508:9: error: use of undeclared identifier 'RPCTypeCheckArgument'
RPCTypeCheckArgument(options, UniValue::VOBJ);
^
2 errors generated.
7701d95 to
3a88c29
Compare
|
Now it builds, but backwards compatibility with passing number instead of object as a third parameter is broken, will look at it later. |
|
Maybe mark as draft/WIP for as long as this is still WIP? |
|
Are you still working on this? If not, maybe close for now |
Will try to look at this. There was bug after rebase (see comment above), need to go through other code changes to understand properly what has changed and what causes the issue. |
|
Are you still working on this? |
Not at the moment. Feel free to close. Will open a new PR in future if will get back to this. |
Taken from #19443. There two additional arguments
paginatebypointerandnextpagepointerwere added and @luke-jr proposed that they could be united with existingskipargument into singleoptionsJSON argument. This is better approach than continue adding more and more different arguments for different output options. #22775 proposes to add sorting order as additional argument, I think it's better to use the same approach there too. Having this as a separate PR will make reviews and testing simpler.Tests for old and new way of providing
skipargument should be added, but didn't do it here as functional tests currently don't have tests forskipat all. I plan to add them later in a separate PR.