fix(rpc): Await state service requests in getblock
method in parallel
#8376
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
This is cleanup in the
getblock
method ahead of adding any additional service calls, adding other fields to thegetblock
response that are provided inzcashd
would likely require another state service call to request the block header, and we may also want to look up the height if the method was called with a block hash.PR Author Checklist
Check before marking the PR as ready for review:
For significant changes:
If a checkbox isn't relevant to the PR, mark it as done.
Complex Code or Requirements
This could change the order in which the state service receives and responds to these requests, which should be okay.
Solution
state.oneshot()
instead of.ready().and_then(svc.call())
for getting the transactions ids, sapling/orchard trees, and block depthFuturesOrdered
Testing
Existing tests should cover this change.
Review
Anyone can review.
Reviewer Checklist
Check before approving the PR:
PR blockers can be dealt with in new tickets or PRs.
And check the PR Author checklist is complete.
Follow Up Work
GetBlock::Object
verbose response of thegetblock
methodjoin!()
instead of aFuturesOrdered
(not done here due torustfmt
issues)From
impl to avoid duplicate code