Skip to content
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

Suggestion for "add(rpc): getblock: return transaction details with verbosity=2" #9084

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented Dec 13, 2024

This is a suggestion for #9083 to fetch all of a block's transactions with a single service call instead of making one per transaction.

It needlessly reads the block header twice, but those are relatively small, should be cached, and fetching transactions by block height avoids looking up transaction ids by location and then transaction locations by id. It'll also make use of RocksDB iterators once #8895 has merged (see https://github.com/ZcashFoundation/zebra/pull/8895/files#diff-9781032518c3c6d10a656ef34d8b7a85325f9c55c5fd65856b2257786459fd50R226-R234).

We could later factor out some of the getblockheader method to re-use that code without reading the block header twice.

…to the state service for all of a block's transactions.
@arya2 arya2 requested a review from conradoplg December 13, 2024 01:12
@arya2 arya2 self-assigned this Dec 13, 2024
@arya2 arya2 requested a review from a team as a code owner December 13, 2024 01:12
@arya2 arya2 requested review from upbqdn and removed request for a team December 13, 2024 01:12
@arya2 arya2 changed the base branch from main to get-block-tx-objs December 13, 2024 01:12
Copy link
Collaborator

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion, that's much better, thanks!

@conradoplg conradoplg merged commit 08f0721 into get-block-tx-objs Dec 13, 2024
52 of 59 checks passed
@conradoplg conradoplg deleted the get-block-tx-objs-suggestion branch December 13, 2024 14:44
@mpguerra mpguerra linked an issue Dec 13, 2024 that may be closed by this pull request
mergify bot pushed a commit that referenced this pull request Dec 14, 2024
* getblock: return tx objects with verbosity=2

* fix test

* use FuturesOrdered

* Suggestion for "add(rpc): getblock: return transaction details with verbosity=2" (#9084)

* Replaces multiple service calls (per transaction) with a single call to the state service for all of a block's transactions.

* adjustments to reuse code from getrawtransaction

---------

Co-authored-by: Conrado Gouvea <[email protected]>

* update snapshot

---------

Co-authored-by: Arya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getblock: return transactions details with verbosity=2
2 participants