Merge pull request #5595 from paritytech/no-warp-if-disabled

only enable warp sync when engine supports it
This commit is contained in:
Robert Habermeier 2017-05-13 15:04:06 +02:00 committed by GitHub
commit 4df1772078
2 changed files with 7 additions and 1 deletions

View File

@ -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 }

View File

@ -427,8 +427,9 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> 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;