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

fix(downloader): remove optimization for single full block download #6820

Merged
merged 1 commit into from Feb 27, 2024

Conversation

rkrasiuk
Copy link
Member

Description

Remove optimization for a single full block download where the block body request was dispatched immediately.

  1. The check here should've been inverse

    // Optimization: if we only want one block, we don't need to wait for the headers request
    // to complete, and can send the block bodies request right away.
    let bodies_request =
    if count == 1 { None } else { Some(client.get_block_bodies(vec![hash])) };

  2. If the block body response arrives before the header response, it will be discarded here

    fn insert_body(&mut self, body_response: BodyResponse) {
    if let Some(header) = self.pending_headers.pop_front() {
    self.bodies.insert(header, body_response);
    }
    }

@rkrasiuk rkrasiuk added C-bug An unexpected or incorrect behavior A-downloaders Related to headers/bodies downloaders labels Feb 27, 2024
@mattsse mattsse added this pull request to the merge queue Feb 27, 2024
Merged via the queue into main with commit 649db66 Feb 27, 2024
29 checks passed
@mattsse mattsse deleted the rkrasiuk/downloader-rm-single-full-block-optimization branch February 27, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-downloaders Related to headers/bodies downloaders C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants