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

Commit

Permalink
Merge pull request #6691 from paritytech/warp-options
Browse files Browse the repository at this point in the history
Fix warp sync blockers detection
  • Loading branch information
debris authored Oct 10, 2017
2 parents 3c4fa55 + 0076294 commit e3fa460
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
17 changes: 3 additions & 14 deletions parity/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::time::Duration;
use std::io::{Read, Write, stderr};
use std::io::Read;
use std::net::SocketAddr;
use std::path::{Path, PathBuf};
use std::collections::BTreeMap;
Expand All @@ -27,7 +27,6 @@ use bigint::prelude::U256;
use bigint::hash::H256;
use util::{version_data, Address};
use bytes::Bytes;
use util::journaldb::Algorithm;
use ansi_term::Colour;
use ethsync::{NetworkConfiguration, is_valid_node_url};
use ethcore::ethstore::ethkey::{Secret, Public};
Expand All @@ -41,7 +40,7 @@ use parity_rpc::NetworkSettings;
use cache::CacheConfig;
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, replace_home, replace_home_and_local,
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit, to_queue_strategy};
use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, Pruning, Switch};
use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras};
use ethcore_logger::Config as LogConfig;
use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path};
use dapps::Configuration as DappsConfiguration;
Expand Down Expand Up @@ -129,17 +128,7 @@ impl Configuration {
let compaction = self.args.arg_db_compaction.parse()?;
let wal = !self.args.flag_fast_and_loose;
let public_node = self.args.flag_public_node;
if !self.args.flag_no_warp {
// Logging is not initialized yet, so we print directly to stderr
if fat_db == Switch::On {
writeln!(&mut stderr(), "Warning: Warp Sync is disabled because Fat DB is turned on").expect("Error writing to stderr");
} else if tracing == Switch::On {
writeln!(&mut stderr(), "Warning: Warp Sync is disabled because tracing is turned on").expect("Error writing to stderr");
} else if pruning == Pruning::Specific(Algorithm::Archive) {
writeln!(&mut stderr(), "Warning: Warp Sync is disabled because pruning mode is set to archive").expect("Error writing to stderr");
}
}
let warp_sync = !self.args.flag_no_warp && fat_db != Switch::On && tracing != Switch::On && pruning != Pruning::Specific(Algorithm::Archive);
let warp_sync = !self.args.flag_no_warp;
let geth_compatibility = self.args.flag_geth;
let dapps_conf = self.dapps_config();
let ipfs_conf = self.ipfs_config();
Expand Down
17 changes: 16 additions & 1 deletion parity/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use ansi_term::Colour;
use util::version;
use parking_lot::{Condvar, Mutex};
use node_filter::NodeFilter;
use util::journaldb::Algorithm;

use params::{
SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch,
Expand Down Expand Up @@ -496,7 +497,21 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
}

sync_config.fork_block = spec.fork_block();
sync_config.warp_sync = spec.engine.supports_warp() && cmd.warp_sync;
let mut warp_sync = cmd.warp_sync;
if warp_sync {
// Logging is not initialized yet, so we print directly to stderr
if fat_db {
warn!("Warning: Warp Sync is disabled because Fat DB is turned on.");
warp_sync = false;
} else if tracing {
warn!("Warning: Warp Sync is disabled because tracing is turned on.");
warp_sync = false;
} else if algorithm != Algorithm::OverlayRecent {
warn!("Warning: Warp Sync is disabled because of non-default pruning mode.");
warp_sync = false;
}
}
sync_config.warp_sync = spec.engine.supports_warp() && warp_sync;
sync_config.download_old_blocks = cmd.download_old_blocks;
sync_config.serve_light = cmd.serve_light;

Expand Down

0 comments on commit e3fa460

Please sign in to comment.