Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[NC-2138] Extract out generic parts of Downloader #659

Merged

Conversation

ajsutton
Copy link
Contributor

PR description

Extract out the reusable parts of the chain download process into a separate class with pluggable implementations for finding the sync target and creating the block import task. This provides the foundation for adding a fast sync chain downloader.

…t of the Downloader logic in preparation for introducing a fast sync chain downloader.
@@ -98,11 +95,16 @@ public void start() {
}
}

@VisibleForTesting
public CompletableFuture<?> getCurrentTask() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this package-private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sadly no because FullSyncDownloader is under ...sync.fullsync package and FastSyncDownloader will be under ...sync.fullsync so this lives under ...sync. I think it's with this bit of pain to be able to have separate packages for fast sync vs full sync specific bits.

}
}

protected abstract Optional<EthPeer> selectBestAvailableSyncTarget();
Copy link
Contributor

Choose a reason for hiding this comment

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

This difference here for fast sync is an extra check that the sync target agrees the pivot block is on the canonical chain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep exactly.

@ajsutton ajsutton merged commit 1d1bb37 into PegaSysEng:master Jan 28, 2019
@ajsutton ajsutton deleted the NC-2138-generic-downloader-separate branch January 28, 2019 23:42
rain-on pushed a commit to rain-on/pantheon that referenced this pull request Jan 29, 2019
Separate the management of sync target and actual import from the rest of the Downloader logic in preparation for introducing a fast sync chain downloader.
vinistevam pushed a commit to vinistevam/pantheon that referenced this pull request Jan 29, 2019
Separate the management of sync target and actual import from the rest of the Downloader logic in preparation for introducing a fast sync chain downloader.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants