-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc listtransactions new argument options (paginatebypointer impl) #14898
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
249c196
to
0115b7a
Compare
Is there a strong reason to not improve existing |
@promag
There's an odd reverse call at Other than that adding |
I general I like the idea of a pointer (seems more reliable) and the sort. |
I would not worry about tests, you should anyway run the functional tests yourself if you change something in RPC. Sort order could be added as an additional optional boolean parameter IMO. As well as other changes. |
Who thinks this line should get removed from |
@hosseinamin Well we can't remove that line; there are likely end users who rely on its behavior, even if it is suboptimal. We can make it optional by adding an extra flag, though. |
Breaking userspace is bad, so changing default behaviour of any RPC should be avoided. |
That's why i did cloned the rpc call. This is how new functionality can come in without messing with userspace. |
Cloning is one way, backward compatible parameterising would be another (see how the account system was removed). |
Okay. How's this?
|
I think |
It's also seems like changes on |
@jonasschnelli Removed listransactions2, And did parametrize it. |
6dd543e
to
d788aae
Compare
src/wallet/rpcwallet.cpp
Outdated
} else if (i == 1) { | ||
try { | ||
nextVOut = std::stoul(s); | ||
} catch (std::invalid_argument &e) { |
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.
Drop &e
? Applies to the three cases below as well :-)
I'm not sure a single parameter that changes multiple things is a right way to go. Wouln't be better to be able to specify sorting order and paging behaviour independently? Besides I don't like "old behaviour vs new behaviour" boolean also because in future there could be a different one "new new behaviour". |
src/rpc/client.cpp
Outdated
@@ -57,7 +57,9 @@ static const CRPCConvertParam vRPCConvertParams[] = | |||
{ "waitfornewblock", 0, "timeout" }, | |||
{ "listtransactions", 1, "count" }, | |||
{ "listtransactions", 2, "skip" }, | |||
{ "listtransactions", 2, "nextpagepointer" }, |
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.
Nit: Isn't this typically called an index rather than a pointer?
src/rpc/client.cpp
Outdated
{ "listtransactions", 3, "include_watchonly" }, | ||
{ "listtransactions", 4, "newversion" }, |
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.
Nit: The newversion
won't be new forever :-) Can you come up with a time independent name?
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Okay. I agree. Want to change |
Linter error from travis:
|
This PR needs review. |
Hey guys. This commit is ready for merge. |
Added fifth param to `listtransactions` named `options`, `options` may be an object containing `paginatebypointer` (boolean default: false) and `nextpagepointer` (string default: OMITTED). With `paginatebypointer` output will have the following changes. 1. Return transactions is ordered by most recent transactions. Though the default does reverse the order after transactions are fetched and clipped. 2. `skip` argument has no effect. Instead `nextpagepointer` will be used for pagination. 3. Return value is an object containing, records (array of txs) and nextpagepointer (string)
Needs rebase |
Checking in on this. It's been a while since there was a rebase and there doesn't appear to be strong conviction from the reviewers on the concept/approach. |
I wasted my time on this pull-request. No need for the merge anymore. Lets dump it in garbage. |
I still think this would have been a good functionality conceptually. |
Added fifth param to
listtransactions
namedoptions
,options
may be an object containingpaginatebypointer
(boolean default: false) andnextpagepointer
(string default: OMITTED).With
paginatebypointer
output will have the following changes.skip
argument has no effect. Insteadnextpagepointer
will be used for pagination.