-
Notifications
You must be signed in to change notification settings - Fork 130
[NC-2138] Extract out generic parts of Downloader #659
[NC-2138] Extract out generic parts of Downloader #659
Conversation
…t of the Downloader logic in preparation for introducing a fast sync chain downloader.
…ync target manager.
@@ -98,11 +95,16 @@ public void start() { | |||
} | |||
} | |||
|
|||
@VisibleForTesting | |||
public CompletableFuture<?> getCurrentTask() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep exactly.
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.
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.
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.