From 56768ff237a65935122b35c3681d95d5df62fa8a Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Wed, 10 May 2017 17:12:00 +0200 Subject: [PATCH] only try to warp when engine supports it --- ethcore/src/engines/mod.rs | 5 +++++ parity/run.rs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 7041048b8..f95cdf9f8 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -296,6 +296,11 @@ pub trait Engine : Sync + Send { None } + /// Whether this engine supports warp sync. + fn supports_warp(&self) -> bool { + self.snapshot_components().is_some() + } + /// Returns new contract address generation scheme at given block number. fn create_address_scheme(&self, number: BlockNumber) -> CreateContractAddress { if number >= self.params().eip86_transition { CreateContractAddress::FromCodeHash } else { CreateContractAddress::FromSenderAndNonce } diff --git a/parity/run.rs b/parity/run.rs index 083cbe5ce..5a5dbca6b 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -427,8 +427,9 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc) -> R } else { sync_config.subprotocol_name.clone_from_slice(spec.subprotocol_name().as_bytes()); } + sync_config.fork_block = spec.fork_block(); - sync_config.warp_sync = cmd.warp_sync; + sync_config.warp_sync = spec.engine.supports_warp() && cmd.warp_sync; sync_config.download_old_blocks = cmd.download_old_blocks; sync_config.serve_light = cmd.serve_light;