add(rpc): getblock: return transaction details with verbosity=2 #9083
+113
−41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
We want getblock to match zcashd. With verbosity=2 we returned a list of hashes, but a list of transaction objects is expected.
Closes #9024
Specifications & References
https://github.com/zcash/zcash/blob/99ad6fdc3a549ab510422820eea5e5ce9f60a5fd/src/rpc/blockchain.cpp#L735
Solution
If
verbosity=2
, callgetrawtransaction
for each tx in the block internally and use its output to fill the transaction details.There are tons of fields missing in
getrawtransaction
, but that will be another issue. When they are filled, they will be automatically returned bygetblock
too.zcashd
seems to not return theheigth
andconfirmations
fields in the transactions details insidegetblock
(which are indeed redundant) but I think it's harmless to return them.Tests
Expanded existing test. Also tested manually with
zcash-cli
.Follow-up Work
See #8446 for other
getblock
related stuff, and we'll need an issue for completinggetrawtransaction
PR Author's Checklist
PR Reviewer's Checklist