-
Notifications
You must be signed in to change notification settings - Fork 37.7k
send* RPCs in the wallet returns the "fee reason" #19501
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
Concept ACK! |
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.
In order for cli to work, you will need to also add the new arguments to src/rpc/client.cpp
.
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. |
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
Added a new commit: added new arguments to |
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
Travis is failing on the linter though, most likely whitespace. You can run it yourself with test/lint/lint-all.sh
(you might need to install a few packages). I left a bunch of nits that you can include with your changes, and then please rebase and squash.
Concept ACK Please squash the fixup commits. |
4866d9b
to
26c306c
Compare
Update: Fixed verbose information and also the log info in wallet_basic.py, also squashed all the nit commits. |
Thank you! But I meant to squash the fix-ups into the original commits. Otherwise, it's harder to review because reviewers can not just go through the commits in order but need to jump back and forth to check if what they see in the first commit is not already changed in a later commit. So, for example |
26c306c
to
05a8182
Compare
Squashed nit commits to [test] send rpcs returns fee reason! |
15f7c1d
to
729845d
Compare
82c8784
to
c5d262f
Compare
099ac12
to
1d64009
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. Locks good beside feedback and https://github.com/bitcoin/bitcoin/pull/19501/files#r459066407
src/wallet/rpcwallet.cpp
Outdated
{ | ||
{RPCResult::Type::STR_HEX, "txid", "The transaction id for the send. Only 1 transaction is created regardless of\n" | ||
"the number of addresses."}, | ||
{RPCResult::Type::BOOL, "fee reason", "The transaction fee reason."} |
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.
{RPCResult::Type::BOOL, "fee reason", "The transaction fee reason."} | |
{RPCResult::Type::STR, "fee reason", "The transaction fee reason."} |
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.
code adjusted based on the feedback. Removed str
from [test] and changed rpc result return to str
19d86d2
to
a3fe42c
Compare
ACK a3fe42c |
@luke-jr @instagibbs @laanwj @fjahr could you please verify whether I've resolved all the problems that you've highlighted? Thank you |
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 a3fe42c
txid_feeReason_one = self.nodes[2].sendtoaddress(address = address, amount = 10, verbose = True) | ||
assert_equal(txid_feeReason_one["fee_reason"], "Fallback fee") | ||
txid_feeReason_two = self.nodes[2].sendmany(dummy = '', amounts = {address: 10}, verbose = True) | ||
assert_equal(txid_feeReason_two["fee_reason"], "Fallback fee") |
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.
maybe add a case where you explicitly pass in verbose = False
to cover that case too 👍
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.
Added verbose = False
case in test file
6d5e3ad
to
6118e9d
Compare
6118e9d
to
69cf5d4
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.
utACK 69cf5d4
@@ -497,8 +514,9 @@ static RPCHelpMan sendtoaddress() | |||
|
|||
std::vector<CRecipient> recipients; | |||
ParseRecipients(address_amounts, subtractFeeFromAmount, recipients); | |||
bool verbose = request.params[9].isNull() ? false: request.params[9].get_bool(); |
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.
micro-nit: spacing between false:
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.
for some reason git is ignoring my whitespace changes. Any suggestions on how to fix that?
}, | ||
{ | ||
RPCResult{"if verbose is not set or set to false", | ||
RPCResult::Type::STR_HEX, "txid", "The transaction id for the send. Only 1 transaction is created regardless of\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.
micro-nit: double space between Only 1
ACK 69cf5d4 |
69cf5d4
to
09eb4d7
Compare
@stackman27 if there are a couple of ACKs then it's better not to fix small nits and leave them in case there's a bigger change that needs to be done. Small spacing nits, etc. won't stop a merge 😄 |
Okay for sure! Thank you |
Mind force pushing the previous reviewed version?
? |
f84dc3a
to
69cf5d4
Compare
Yes just pushed! |
69cf5d4 [test] Make sure send rpc returns fee reason (Sishir Giri) d5863c0 [send] Make send RPCs return fee reason (Sishir Giri) Pull request description: Whenever a wallet funds a transaction, the fee reason is reported to the user only if the verbose is set to true. I added an extra parameter to `CreateTransaction` function in wallet.cpp. Then I implemented the fee reason return logic in `SendMoney` in rpcwallet.cpp, followed by verbose parameter in `sendtoaddress` and `sendmany` functions. I also added a fee reason test case in walletbasic.py. link to the issue: maflcko#22 (comment) ACKs for top commit: instagibbs: ACK bitcoin@69cf5d4 meshcollider: utACK 69cf5d4 Tree-SHA512: 2e3af32dcfbd5511ba95f8bc8edca7acfe709a8430ff03e43172e5d0af3dfa4b2f57906978e7f272d878043b9ed8c6004674cf47d7496b005d5f612e9a58aa0e
Whenever a wallet funds a transaction, the fee reason is reported to the user only if the verbose is set to true. I added an extra parameter to
CreateTransaction
function in wallet.cpp. Then I implemented the fee reason return logic inSendMoney
in rpcwallet.cpp, followed by verbose parameter insendtoaddress
andsendmany
functions. I also added a fee reason test case in walletbasic.py.link to the issue: maflcko#22 (comment)