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

feat: avoid explosion of disordering blocks based on BLOCK_DOWNLOAD_WINDOW #2002

Merged
merged 1 commit into from
Apr 13, 2020

Conversation

keroro520
Copy link
Contributor

The "sync" protocol downloads different blocks from multiple peers. In the case of different download speeds between peers, that will cause some disordering blocks backlog in orphan_pool.

To avoid the explosion of disordering blocks, we limit the download speed based on BLOCK_DOWNLOAD_WINDOW:

// Size of the "block download window": how far ahead of our current height do we fetch?
// Larger windows tolerate larger download speed differences between peers, but increase the
// potential degree of disordering of blocks.
pub const BLOCK_DOWNLOAD_WINDOW: u64 = 1024 * 8; // 1024 * default_outbound_peers

BLOCK_DOWNLOAD_WINDOW should be good enough to limit the disordering blocks but meanwhile, tolerate download speed differences between peers. I am not sure whether 1024 * 8 is good enough, but it is a safe value in my opinion.

@keroro520 keroro520 requested review from a team and xxuejie April 8, 2020 09:05
@keroro520 keroro520 force-pushed the block-download-window branch from 058d415 to 93eccea Compare April 8, 2020 09:20
@keroro520 keroro520 requested review from doitian, driftluo, quake and zhangsoledad and removed request for xxuejie April 8, 2020 09:20
Copy link
Collaborator

@driftluo driftluo left a comment

Choose a reason for hiding this comment

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

Only after asynchronous verification will it work here.

@driftluo
Copy link
Collaborator

bors r+

@nervos-bot nervos-bot bot added the s:ready-to-merge Status: Waiting to be merged. label Apr 13, 2020
@bors
Copy link
Contributor

bors bot commented Apr 13, 2020

Build succeeded

  • continuous-integration/travis-ci/push

@bors bors bot merged commit 6b0ce20 into nervosnetwork:develop Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:ready-to-merge Status: Waiting to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants