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

[NC-2137] Start world downloader #658

Merged
merged 4 commits into from
Jan 28, 2019

Conversation

ajsutton
Copy link
Contributor

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.

import java.util.concurrent.CompletableFuture;

public interface WorldStateDownloader {
CompletableFuture<Void> downloadWorldState(BlockHeader pivotBlockHeader);
Copy link
Contributor Author

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:

  1. Make this interface act as a factory that creates a new instance of the world state downloader as it exists
  2. 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.

Copy link
Contributor

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);
Copy link
Contributor

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.

@ajsutton ajsutton merged commit aa48139 into PegaSysEng:master Jan 28, 2019
@ajsutton ajsutton deleted the NC-2137-start-world-downloader branch January 28, 2019 21:33
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