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

Avoid downloading multiple chains of headers on sync #2017

Closed
wants to merge 2 commits into from

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Mar 26, 2018

The main idea is to never send GETHEADERS if HEADERS message is at its max size (i.e. the peer we got this from should still have more blocks to announce which means that it's most likely not some recent fork or smth like that but actual historical blocks) and all headers in HEADERS message we received are already known. Tested this on testnet and devnet, seems to be working fine and fixing the initial issue completely. Tests also pass with no issues on my local machine and Travis seems to be pretty happy too https://travis-ci.org/UdjinM6/dash/builds/358612242.

Note: This is alternative to #1589 (d7a521d reverts the original PR and all subsequent related changes in one go).

UdjinM6 added 2 commits March 26, 2018 23:47
Reverts "Fix duplicate headers download in initial sync (dashpay#1589)" and all following fixes

This reverts commit 169afaf.
@codablock
Copy link

Wouldn't this result in the same issue as in bitcoin#8054? If a fork happens at exactly lastHeaderHeight+1, you'll miss that fork. If that fork turns out to be the longest chain, you wouldn't be able to catch up.

@UdjinM6
Copy link
Author

UdjinM6 commented Mar 27, 2018

Good point. Also my patch seems to be needlessly complex. Closing.

@UdjinM6 UdjinM6 closed this Mar 27, 2018
@UdjinM6 UdjinM6 deleted the fixdupheaderchains branch November 26, 2020 13:26
@UdjinM6 UdjinM6 removed this from the 12.3 milestone Mar 1, 2021
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.

2 participants