Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
bump kovan snapshot version
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Jul 18, 2017
1 parent 8b1548d commit 4d896eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions ethcore/res/parity-import-tests
Submodule parity-import-tests added at c5fd38
4 changes: 2 additions & 2 deletions ethcore/src/snapshot/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,9 @@ impl SnapshotService for Service {
self.reader.read().as_ref().map(|r| r.manifest().clone())
}

fn min_supported_version(&self) -> Option<u64> {
fn supported_versions(&self) -> Option<(u64, u64)> {
self.engine.snapshot_components()
.map(|c| c.min_supported_version())
.map(|c| (c.min_supported_version(), c.current_version()))
}

fn chunk(&self, hash: H256) -> Option<Bytes> {
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/snapshot/snapshot_service_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pub trait SnapshotService : Sync + Send {
/// Query the most recent manifest data.
fn manifest(&self) -> Option<ManifestData>;

/// Get the minimum supported snapshot version number.
/// Get the supported range of snapshot version numbers.
/// `None` indicates warp sync isn't supported by the consensus engine.
fn min_supported_version(&self) -> Option<u64>;
fn supported_versions(&self) -> Option<(u64, u64)>;

/// Get raw chunk for a given hash.
fn chunk(&self, hash: H256) -> Option<Bytes>;
Expand Down
8 changes: 4 additions & 4 deletions sync/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ impl ChainSync {
}

fn maybe_start_snapshot_sync(&mut self, io: &mut SyncIo) {
if !self.enable_warp_sync || io.snapshot_service().min_supported_version().is_none() {
if !self.enable_warp_sync || io.snapshot_service().supported_versions().is_none() {
return;
}
if self.state != SyncState::WaitingPeers && self.state != SyncState::Blocks && self.state != SyncState::Waiting {
Expand Down Expand Up @@ -1044,11 +1044,11 @@ impl ChainSync {
Ok(manifest) => manifest,
};

let is_supported_version = io.snapshot_service().min_supported_version()
.map_or(false, |v| manifest.version >= v);
let is_supported_version = io.snapshot_service().supported_versions()
.map_or(false, |(l, h)| manifest.version >= l && manifest.version <= h);

if !is_supported_version {
trace!(target: "sync", "{}: Snapshot manifest version too low: {}", peer_id, manifest.version);
trace!(target: "sync", "{}: Snapshot manifest version not supported: {}", peer_id, manifest.version);
io.disable_peer(peer_id);
self.continue_sync(io);
return Ok(());
Expand Down

0 comments on commit 4d896eb

Please sign in to comment.