This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Tidy-up FastSyncState persistence #845
Merged
ajsutton
merged 9 commits into
PegaSysEng:master
from
ajsutton:synchronizer-checks-fast-sync-allowed
Feb 13, 2019
Merged
Tidy-up FastSyncState persistence #845
ajsutton
merged 9 commits into
PegaSysEng:master
from
ajsutton:synchronizer-checks-fast-sync-allowed
Feb 13, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allow fast sync to resume if chain head is not genesis but a fast sync is still in progress. If present, use the stored pivot block header when restarting. Extract the fast sync logic out of DefaultSynchronizer into it's own class.
…izer-checks-fast-sync-allowed
…t into the FastSyncDownloader.start method.
…ate loading and storing of FastSyncState instances.
…izer-checks-fast-sync-allowed
mbaxter
approved these changes
Feb 13, 2019
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.
nice 🎉
try { | ||
if (!isFastSyncInProgress()) { | ||
return Optional.empty(); | ||
return FastSyncState.EMPTY_SYNC_STATE; | ||
} | ||
final BytesValue rlp = BytesValue.wrap(Files.toByteArray(pivotBlockHeaderFile)); | ||
return Optional.of( |
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.
Doesn't look like this needs to be wrapped in an Optional
now?
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.
Fixed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR description
Improves the way
FastSyncState
is stored and loaded, particularly how that's integrated into the fast sync download process.PivotHeaderStorage
has been changed toFastSyncStateStorage
and now fully encapsulates loading and storing ofFastSyncState
rather than just aBlockHeader
. I started out pushing this intoFastSyncState
but required makingFastSyncState
aware of the fast sync data directory which polluted it and made testing harder.The persisted state is now loaded upfront by
FastSynchronizer
as part of determining if fast sync can be used and then passed into theFastSyncDownloader
to start the download process. Previously it was reloaded by theselectPivotBlock
step. This leads to some nice consistency in that every step of the download process takes aFastSyncState
and returns a (potentially different) one.Also simplified the constructors for
FastSyncState
, that led to a fair bit of noise in the change set sorry...