-
Notifications
You must be signed in to change notification settings - Fork 130
[NC-2137] Start world downloader #658
[NC-2137] Start world downloader #658
Conversation
…nloads which are the last steps in the fast sync process.
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface WorldStateDownloader { | ||
CompletableFuture<Void> downloadWorldState(BlockHeader pivotBlockHeader); |
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.
@mbaxter this is the API I'd ideally like for the world state downloader which doesn't quite match #657 where the pivot block header is passed into the constructor. There are two ways around this which both seem reasonable:
- Make this interface act as a factory that creates a new instance of the world state downloader as it exists
- Change the world state downloader run method to take the pivot block header
The main thing is to ensure we don't wind up with two concurrent world state downloads which is maybe slightly more straight forward with option 2, but the way FastSyncDownloader
manages the returned futures should take care of it anyway.
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.
I like option #2 - that probably make more sense than fixing the header in the constructor.
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface WorldStateDownloader { | ||
CompletableFuture<Void> downloadWorldState(BlockHeader pivotBlockHeader); |
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.
I like option #2 - that probably make more sense than fixing the header in the constructor.
PR description
Extends the fast sync download process to include starting off the (currently unimplemented) world state and chain downloads. If either fails the other is cancelled and the overall fast sync process doesn't complete until both are complete.