PR #16866 renamed the decode argument in gettransaction to verbose to make it more consistent with other RPC calls like getrawtransaction. However, it inadvertently overloaded the "details" field when verbose is passed. The result is that the original "details" field is no longer returned correctly, which seems to be a breaking API change.
This PR:
takes the simplest path to restoring the "details" field by renaming the decoded one back to "decoded" while leaving the verbose argument for API consistency, which was the main intent of #16866,
addresses this comment by mentioning in the RPC help that the new decoded field is equivalent to decoderawtransaction, and
updates the help, functional test, and release note.
Reviewers, to test this manually, build and run bitcoin-cli help gettransaction and bitcoin-cli gettransaction <wallet txid> false true, and verify that the command returns both details and decoded fields.
rpc: fix regression in gettransaction
PR 16866 renamed the 'decode' argument in gettransaction to 'verbose' to make it more consistent with other RPC calls like getrawtransaction.
However, it seems it inadvertently overloaded the 'details' fields when 'verbose' is passed. The result is that the original 'details' fields are no longer returned, which seems to be a breaking API change.
This PR takes the simplest path to restoring the 'details' fields by renaming them from 'details' back to 'decoded', while leaving the 'verbose' argument for API consistency.
It also addresses [this comment](https://github.com/bitcoin/bitcoin/pull/16185#discussion_r320740413) to mention that the 'decoded' field is identical to decoderawtransaction.
Update the RPC help, functional test, and release note.
0f34f54888
DrahtBot added the label Docs on Sep 14, 2019
DrahtBot added the label RPC/REST/ZMQ on Sep 14, 2019
DrahtBot added the label Tests on Sep 14, 2019
DrahtBot added the label Wallet on Sep 14, 2019
meshcollider added this to the milestone 0.19.0 on Sep 14, 2019
meshcollider removed the label Docs on Sep 14, 2019
meshcollider removed the label Tests on Sep 14, 2019
meshcollider removed the label Wallet on Sep 14, 2019
meshcollider
commented at 9:23 PM on September 14, 2019:
contributor
promag
commented at 9:48 PM on September 14, 2019:
member
I feel embarrassed for not catching this previously.. That said, to me this is also an indication that the verbose test is incomplete, it should test the full response if verbose=true. BTW I think this is a good practice because it allows to better test how parameters interact with each other and how it affects the result.
Also related, and I already said this previously in other PR, I think all .pushKV calls to build a response should throw instead of overwriting. I feel that most certainly the developer doesn't want to overwrite, and as such execution should abort (note that these JSON keys are never user input).
jnewbery
commented at 11:12 PM on September 14, 2019:
member
concept ACK.
I feel embarrassed for not catching this previously..
... but not as embarrassed as I feel for writing it!
the verbose test is incomplete, it should test the full response if verbose=true
I agree that wallet_basic.py should be updated to test the details field, with verbose set to both True and False.
I think all .pushKV calls to build a response should throw instead of overwriting
Concept ACK. Let me know when there's a PR to review.
jonatack
commented at 11:18 PM on September 14, 2019:
member
@promag, @jnewbery: :+1: agree with both of your ideas for improving the test coverage. I'll do that tomorrow and let @promag add .pushKV throwing instead of overwriting.
fanquake added the label Waiting for author on Sep 15, 2019
darosior approved
darosior
commented at 12:40 PM on September 15, 2019:
member
- Test gettransaction response without verbose, with verbose=False, and with verbose=True.
- In each case, test presence of expected fields in the output, including absence of the "decoded" field when `verbose` is not passed or false.
- Test that the "details" field contains the expected receive vout in each case.
1b41c2c8a1
jonatack force-pushed on Sep 15, 2019
jnewbery
commented at 5:07 PM on September 15, 2019:
member
tACK1b41c2c8a126ef4be183e1d800a17d85cab8837b
New tests are great. Thanks Jon!
jonatack
commented at 5:07 PM on September 15, 2019:
member
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me