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
wallet, rpc: add label
to listsinceblock
#25934
wallet, rpc: add label
to listsinceblock
#25934
Conversation
bfb8464
to
cf00489
Compare
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.
ACK cf00489
CI error is not related
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. 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. |
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.
Concept ACK
I think this change can be useful for accountability.
2097d20
to
cd444f4
Compare
cd444f4
to
1c373dd
Compare
1c373dd
to
2ddf967
Compare
2ddf967
to
ee284ff
Compare
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.
ACK ee284ff
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.
Concept ACK. If I understand correctly, it looks like the PR title and description should describe this functionality as filtering the results by those having the label.
src/wallet/rpc/transactions.cpp
Outdated
@@ -552,6 +552,8 @@ RPCHelpMan listsinceblock() | |||
{"include_removed", RPCArg::Type::BOOL, RPCArg::Default{true}, "Show transactions that were removed due to a reorg in the \"removed\" array\n" | |||
"(not guaranteed to work on pruned nodes)"}, | |||
{"include_change", RPCArg::Type::BOOL, RPCArg::Default{false}, "Also add entries for change outputs.\n"}, | |||
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, should be a valid label name to return only incoming transactions\n" |
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.
Seems this can be shorter and on one line
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, should be a valid label name to return only incoming transactions\n" | |
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Return only incoming transactions\n" |
and s/with/having/
Unlike listtransactions, I wasn't able to get an invalid label error with listsinceblock. Maybe test for that like the one in test/functional/wallet_listtransactions.py::L282, if the label can be invalid in listsinceblock.
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.
Perfect, you're right. Gonna update it.
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 working on this in #26186.
I didn't think it would fit the scope of this PR.
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 PR doesn't seem to touch/fix the invalidity check for listsinceblock. Should it be done here while adding the arg, or do you plan to update that pull after this one?
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.
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.
Unlike listtransactions, I wasn't able to get an invalid label error with listsinceblock
I think in listtransactions
label
parameter is the first one, so you pass a value like "*" or a real name and if you try it with an empty label
it throws an error. In this case, label
is the last parameter, you can pass a label or leave it empty to fetch all, there is no need to adopt the same pattern as listtransactions
.
ee284ff
to
2a86921
Compare
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.
re-ACK 2a86921 - minor changes and documentation improvements since my last review.
src/wallet/rpc/transactions.cpp
Outdated
@@ -552,6 +552,8 @@ RPCHelpMan listsinceblock() | |||
{"include_removed", RPCArg::Type::BOOL, RPCArg::Default{true}, "Show transactions that were removed due to a reorg in the \"removed\" array\n" | |||
"(not guaranteed to work on pruned nodes)"}, | |||
{"include_change", RPCArg::Type::BOOL, RPCArg::Default{false}, "Also add entries for change outputs.\n"}, | |||
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, should be a valid label name to return only incoming transactions\n" |
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 PR doesn't seem to touch/fix the invalidity check for listsinceblock. Should it be done here while adding the arg, or do you plan to update that pull after this one?
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.
Not sure, but should the PR title and description describe this functionality as filtering the results by those having the label?
c15c9b5
to
0ff870f
Compare
Just updated the description. |
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.
ACK 0ff870f
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.
reACK 0ff870f - minor changes and documentation improvements since my last review.
219b7f0
to
c9b60d3
Compare
Force-pushed rebasing and addressing @jonatack's suggestion for the test. |
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.
ACK c9b60d3
@brunoerg it might be good to un-resolve the discussion from #25934 (comment) as it needs to be addressed (if I'm not confused). |
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.
reACK c9b60d3
c9b60d3
to
4e362c2
Compare
Force-pushed rebasing. |
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.
ACK 4e362c2
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.
ACK 4e362c2
ACK 4e362c2 |
4e362c2 doc: add release note for 25934 (brunoerg) fe488b4 test: add coverage for `label` in `listsinceblock` (brunoerg) 722e9a4 wallet, rpc: add `label` to `listsinceblock` (brunoerg) 852891f refactor, wallet: use optional for `label` in `ListTransactions` (brunoerg) Pull request description: This PR adds `label` parameter to `listsinceblock` to be able to fetch all incoming transactions having the specified label since a specific block. It's possible to use it in `listtransactions`, however, it's only possible to set the number of transactions to return, not a specific block to fetch from. `getreceivedbylabel` only returns the total amount received, not the txs info. `listreceivedbylabel` doesn't list all the informations about the transactions and it's not possible to fetch since a block. ACKs for top commit: achow101: ACK 4e362c2 w0xlt: ACK bitcoin@4e362c2 aureleoules: ACK 4e362c2 Tree-SHA512: fbde5db8cebf7a27804154fa61997b5155ad512e978cebb78c17acab9efcb624ea5f39d649899d12e5e675f80d4d0064cae8132b864de0d93a8d1e6fbcb9a737
This PR adds
label
parameter tolistsinceblock
to be able to fetch all incoming transactions having the specified label since a specific block.It's possible to use it in
listtransactions
, however, it's only possible to set the number of transactions to return, not a specific block to fetch from.getreceivedbylabel
only returns the total amount received, not the txs info.listreceivedbylabel
doesn't list all the informations about the transactions and it's not possible to fetch since a block.