Skip to content

Commit

Permalink
remove snapshot_restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Jun 1, 2018
1 parent d8735f0 commit 075c94c
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ethcore/light/src/client/snapshot/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl ChainRestorationParams for LightClientRestorationParams {
let db = restoration_db_handler.open(&rest_db)?;
let chain = HeaderChain::new(db.clone(), self.col, &self.spec, self.cache.clone(), self.allow_hs)?;
let boxed = Box::new(LightChain::new(chain));
let restoration = engine.snapshot_restoration()
let restoration = engine.snapshot_components()
.ok_or_else(|| SnapshotError::SnapshotsUnsupported)?;

let rebuilder = restoration.rebuilder(boxed, db.clone(), &manifest)?;
Expand Down
8 changes: 0 additions & 8 deletions ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,14 +1353,6 @@ impl Engine<EthereumMachine> for AuthorityRound {
fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> super::ForkChoice {
super::total_difficulty_fork_choice(new, current)
}

fn snapshot_restoration(&self) -> Option<Box<::snapshot::RebuilderFactory>> {
if self.immediate_transitions {
None
} else {
Some(Box::new(::snapshot::PoaSnapshot))
}
}
}

#[cfg(test)]
Expand Down
10 changes: 2 additions & 8 deletions ethcore/src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use builtin::Builtin;
use vm::{EnvInfo, Schedule, CreateContractAddress};
use error::Error;
use header::{Header, BlockNumber};
use snapshot::{SnapshotComponents, RebuilderFactory};
use snapshot::SnapshotComponents;
use spec::CommonParams;
use transaction::{self, UnverifiedTransaction, SignedTransaction};

Expand Down Expand Up @@ -342,15 +342,9 @@ pub trait Engine<M: Machine>: Sync + Send {
None
}

/// Create a factory for restoring from snapshot chunks.
/// Returning `None` indicates that this engine doesn't support restoring from a snapshot.
fn snapshot_restoration(&self) -> Option<Box<RebuilderFactory>> {
None
}

/// Whether this engine supports warp sync.
fn supports_warp(&self) -> bool {
self.snapshot_restoration().is_some()
self.snapshot_components().is_some()
}

/// Return a new open block header timestamp based on the parent timestamp.
Expand Down
4 changes: 0 additions & 4 deletions ethcore/src/engines/null_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ impl<M: WithBalances + WithRewards> Engine<M> for NullEngine<M>
Some(Box::new(::snapshot::PowSnapshot::new(10000, 10000)))
}

fn snapshot_restoration(&self) -> Option<Box<::snapshot::RebuilderFactory>> {
Some(Box::new(::snapshot::PowSnapshot::new(10000, 10000)))
}

fn fork_choice(&self, new: &M::ExtendedHeader, current: &M::ExtendedHeader) -> super::ForkChoice {
super::total_difficulty_fork_choice(new, current)
}
Expand Down
4 changes: 0 additions & 4 deletions ethcore/src/engines/tendermint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,6 @@ impl Engine<EthereumMachine> for Tendermint {
Some(Box::new(::snapshot::PoaSnapshot))
}

fn snapshot_restoration(&self) -> Option<Box<::snapshot::RebuilderFactory>> {
Some(Box::new(::snapshot::PoaSnapshot))
}

fn stop(&self) {
self.step_service.stop()
}
Expand Down
4 changes: 0 additions & 4 deletions ethcore/src/ethereum/ethash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,6 @@ impl Engine<EthereumMachine> for Arc<Ethash> {
Some(Box::new(::snapshot::PowSnapshot::new(SNAPSHOT_BLOCKS, MAX_SNAPSHOT_BLOCKS)))
}

fn snapshot_restoration(&self) -> Option<Box<::snapshot::RebuilderFactory>> {
Some(Box::new(::snapshot::PowSnapshot::new(SNAPSHOT_BLOCKS, MAX_SNAPSHOT_BLOCKS)))
}

fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice {
engines::total_difficulty_fork_choice(new, current)
}
Expand Down

0 comments on commit 075c94c

Please sign in to comment.