Compiles.
This commit is contained in:
parent
90b5d1c62d
commit
03ef95ba50
@ -270,8 +270,7 @@ impl DatabaseService for Database {
|
|||||||
Ok(next_iterator)
|
Ok(next_iterator)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iter_next(&self, handle: IteratorHandle) -> Option<KeyValue>
|
fn iter_next(&self, handle: IteratorHandle) -> Option<KeyValue> {
|
||||||
{
|
|
||||||
let mut iterators = self.iterators.write();
|
let mut iterators = self.iterators.write();
|
||||||
let mut iterator = match iterators.get_mut(&handle) {
|
let mut iterator = match iterators.get_mut(&handle) {
|
||||||
Some(some_iterator) => some_iterator,
|
Some(some_iterator) => some_iterator,
|
||||||
|
@ -129,7 +129,6 @@ impl SleepState {
|
|||||||
/// Call `import_block()` to import a block asynchronously; `flush_queue()` flushes the queue.
|
/// Call `import_block()` to import a block asynchronously; `flush_queue()` flushes the queue.
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
mode: Mutex<Mode>,
|
mode: Mutex<Mode>,
|
||||||
update_policy: UpdatePolicy,
|
|
||||||
chain: RwLock<Arc<BlockChain>>,
|
chain: RwLock<Arc<BlockChain>>,
|
||||||
tracedb: RwLock<TraceDB<BlockChain>>,
|
tracedb: RwLock<TraceDB<BlockChain>>,
|
||||||
engine: Arc<Engine>,
|
engine: Arc<Engine>,
|
||||||
@ -227,6 +226,8 @@ impl Client {
|
|||||||
accountdb: Default::default(),
|
accountdb: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let client = Arc::new(Client {
|
let client = Arc::new(Client {
|
||||||
sleep_state: Mutex::new(SleepState::new(awake)),
|
sleep_state: Mutex::new(SleepState::new(awake)),
|
||||||
liveness: AtomicBool::new(awake),
|
liveness: AtomicBool::new(awake),
|
||||||
@ -262,7 +263,7 @@ impl Client {
|
|||||||
if let Ok(ops_addr) = registrar.get_address(&(&b"operations"[..]).sha3(), "A") {
|
if let Ok(ops_addr) = registrar.get_address(&(&b"operations"[..]).sha3(), "A") {
|
||||||
if !ops_addr.is_zero() {
|
if !ops_addr.is_zero() {
|
||||||
trace!(target: "client", "Found operations at {}", ops_addr);
|
trace!(target: "client", "Found operations at {}", ops_addr);
|
||||||
*client.updater.lock() = Some(Updater::new(Arc::downgrade(&client), ops_addr));
|
*client.updater.lock() = Some(Updater::new(Arc::downgrade(&client), ops_addr, client.config.update_policy.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*client.registrar.lock() = Some(registrar);
|
*client.registrar.lock() = Some(registrar);
|
||||||
|
@ -66,33 +66,39 @@ impl FromStr for DatabaseCompactionProfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Filter for releases.
|
||||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||||
pub enum UpdateFilter {
|
pub enum UpdateFilter {
|
||||||
|
/// All releases following the same track.
|
||||||
All,
|
All,
|
||||||
|
/// Only those of the same minor version potentially changing tracks.
|
||||||
Patch,
|
Patch,
|
||||||
|
/// As with `All`, but only those which are known to be critical.
|
||||||
Critical,
|
Critical,
|
||||||
|
/// None.
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The policy for auto-updating.
|
||||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||||
pub struct UpdatePolicy {
|
pub struct UpdatePolicy {
|
||||||
download_only: bool,
|
/// Download potential updates.
|
||||||
track: Track,
|
pub enable_downloading: bool,
|
||||||
|
/// Which of those downloaded should be automatically installed.
|
||||||
|
pub filter: UpdateFilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Operating mode for the client.
|
impl Default for UpdatePolicy {
|
||||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
fn default() -> Self {
|
||||||
pub enum UpdatePolicy {
|
UpdatePolicy {
|
||||||
/// Always on.
|
enable_downloading: false,
|
||||||
Active,
|
filter: UpdateFilter::None,
|
||||||
/// Goes offline after RLP is inactive for some (given) time, but
|
}
|
||||||
/// comes back online after a while of inactivity.
|
}
|
||||||
Passive(Duration, Duration),
|
}
|
||||||
/// Goes offline after RLP is inactive for some (given) time and
|
|
||||||
/// stays inactive.
|
impl UpdatePolicy {
|
||||||
Dark(Duration),
|
pub fn new() -> Self { Default::default() }
|
||||||
/// Always off.
|
|
||||||
Off,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Operating mode for the client.
|
/// Operating mode for the client.
|
||||||
@ -130,6 +136,8 @@ impl Display for Mode {
|
|||||||
/// Client configuration. Includes configs for all sub-systems.
|
/// Client configuration. Includes configs for all sub-systems.
|
||||||
#[derive(Debug, PartialEq, Default)]
|
#[derive(Debug, PartialEq, Default)]
|
||||||
pub struct ClientConfig {
|
pub struct ClientConfig {
|
||||||
|
/// Updater policy.
|
||||||
|
pub update_policy: UpdatePolicy,
|
||||||
/// Block queue configuration.
|
/// Block queue configuration.
|
||||||
pub queue: QueueConfig,
|
pub queue: QueueConfig,
|
||||||
/// Blockchain configuration.
|
/// Blockchain configuration.
|
||||||
|
@ -26,7 +26,7 @@ mod client;
|
|||||||
mod updater;
|
mod updater;
|
||||||
|
|
||||||
pub use self::client::*;
|
pub use self::client::*;
|
||||||
pub use self::config::{Mode, ClientConfig, UpdatePolicy, Automation, DatabaseCompactionProfile, BlockChainConfig, VMType};
|
pub use self::config::{Mode, ClientConfig, UpdatePolicy, UpdateFilter, DatabaseCompactionProfile, BlockChainConfig, VMType};
|
||||||
pub use self::error::Error;
|
pub use self::error::Error;
|
||||||
pub use types::ids::*;
|
pub use types::ids::*;
|
||||||
pub use self::test_client::{TestBlockChainClient, EachBlockWith};
|
pub use self::test_client::{TestBlockChainClient, EachBlockWith};
|
||||||
|
@ -18,8 +18,7 @@ use std::sync::Weak;
|
|||||||
use util::misc::{VersionInfo, ReleaseTrack, platform};
|
use util::misc::{VersionInfo, ReleaseTrack, platform};
|
||||||
use util::{Address, H160, H256, FixedHash};
|
use util::{Address, H160, H256, FixedHash};
|
||||||
use client::operations::Operations;
|
use client::operations::Operations;
|
||||||
use client::client::Client;
|
use client::{Client, UpdatePolicy, BlockId};
|
||||||
use client::BlockId;
|
|
||||||
|
|
||||||
pub struct ReleaseInfo {
|
pub struct ReleaseInfo {
|
||||||
fork_supported: usize,
|
fork_supported: usize,
|
||||||
@ -34,15 +33,13 @@ pub struct Updater {
|
|||||||
client: Weak<Client>,
|
client: Weak<Client>,
|
||||||
operations: Operations,
|
operations: Operations,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub this: VersionInfo,
|
pub this: VersionInfo,
|
||||||
pub release_info: Option<ReleaseInfo>,
|
pub release_info: Option<ReleaseInfo>,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Updater {
|
impl Updater {
|
||||||
pub fn new(client: Weak<Client>, operations: Address) -> Self {
|
pub fn new(client: Weak<Client>, operations: Address, _update_policy: UpdatePolicy) -> Self {
|
||||||
let mut u = Updater {
|
let mut u = Updater {
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
operations: Operations::new(operations, move |a, d| client.upgrade().ok_or("No client!".into()).and_then(|c| c.call_contract(a, d))),
|
operations: Operations::new(operations, move |a, d| client.upgrade().ok_or("No client!".into()).and_then(|c| c.call_contract(a, d))),
|
||||||
|
@ -153,7 +153,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<String, String> {
|
|||||||
try!(execute_upgrades(&db_dirs, algorithm, cmd.compaction.compaction_profile(db_dirs.fork_path().as_path())));
|
try!(execute_upgrades(&db_dirs, algorithm, cmd.compaction.compaction_profile(db_dirs.fork_path().as_path())));
|
||||||
|
|
||||||
// prepare client config
|
// prepare client config
|
||||||
let client_config = to_client_config(&cmd.cache_config, Mode::Active, tracing, fat_db, cmd.compaction, cmd.wal, cmd.vm_type, "".into(), algorithm, cmd.pruning_history, cmd.check_seal);
|
let client_config = to_client_config(&cmd.cache_config, Default::default(), Mode::Active, tracing, fat_db, cmd.compaction, cmd.wal, cmd.vm_type, "".into(), algorithm, cmd.pruning_history, cmd.check_seal);
|
||||||
|
|
||||||
// build client
|
// build client
|
||||||
let service = try!(ClientService::start(
|
let service = try!(ClientService::start(
|
||||||
@ -304,7 +304,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<String, String> {
|
|||||||
try!(execute_upgrades(&db_dirs, algorithm, cmd.compaction.compaction_profile(db_dirs.fork_path().as_path())));
|
try!(execute_upgrades(&db_dirs, algorithm, cmd.compaction.compaction_profile(db_dirs.fork_path().as_path())));
|
||||||
|
|
||||||
// prepare client config
|
// prepare client config
|
||||||
let client_config = to_client_config(&cmd.cache_config, Mode::Active, tracing, fat_db, cmd.compaction, cmd.wal, VMType::default(), "".into(), algorithm, cmd.pruning_history, cmd.check_seal);
|
let client_config = to_client_config(&cmd.cache_config, Default::default(), Mode::Active, tracing, fat_db, cmd.compaction, cmd.wal, VMType::default(), "".into(), algorithm, cmd.pruning_history, cmd.check_seal);
|
||||||
|
|
||||||
let service = try!(ClientService::start(
|
let service = try!(ClientService::start(
|
||||||
client_config,
|
client_config,
|
||||||
|
@ -78,6 +78,8 @@ usage! {
|
|||||||
flag_mode_timeout: u64 = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(),
|
flag_mode_timeout: u64 = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(),
|
||||||
flag_mode_alarm: u64 = 3600u64, or |c: &Config| otry!(c.parity).mode_alarm.clone(),
|
flag_mode_alarm: u64 = 3600u64, or |c: &Config| otry!(c.parity).mode_alarm.clone(),
|
||||||
flag_auto_update: String = "consensus", or |c: &Config| otry!(c.parity).auto_update.clone(),
|
flag_auto_update: String = "consensus", or |c: &Config| otry!(c.parity).auto_update.clone(),
|
||||||
|
flag_no_download: bool = false, or |c: &Config| otry!(c.parity).no_download.clone(),
|
||||||
|
flag_no_consensus: bool = false, or |c: &Config| otry!(c.parity).no_consensus.clone(),
|
||||||
flag_chain: String = "homestead", or |c: &Config| otry!(c.parity).chain.clone(),
|
flag_chain: String = "homestead", or |c: &Config| otry!(c.parity).chain.clone(),
|
||||||
flag_db_path: String = "$HOME/.parity", or |c: &Config| otry!(c.parity).db_path.clone(),
|
flag_db_path: String = "$HOME/.parity", or |c: &Config| otry!(c.parity).db_path.clone(),
|
||||||
flag_keys_path: String = "$HOME/.parity/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
|
flag_keys_path: String = "$HOME/.parity/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
|
||||||
@ -290,6 +292,9 @@ struct Operating {
|
|||||||
mode: Option<String>,
|
mode: Option<String>,
|
||||||
mode_timeout: Option<u64>,
|
mode_timeout: Option<u64>,
|
||||||
mode_alarm: Option<u64>,
|
mode_alarm: Option<u64>,
|
||||||
|
auto_update: Option<String>,
|
||||||
|
no_download: Option<bool>,
|
||||||
|
no_consensus: Option<bool>,
|
||||||
chain: Option<String>,
|
chain: Option<String>,
|
||||||
db_path: Option<String>,
|
db_path: Option<String>,
|
||||||
keys_path: Option<String>,
|
keys_path: Option<String>,
|
||||||
@ -504,6 +509,8 @@ mod tests {
|
|||||||
flag_mode_timeout: 300u64,
|
flag_mode_timeout: 300u64,
|
||||||
flag_mode_alarm: 3600u64,
|
flag_mode_alarm: 3600u64,
|
||||||
flag_auto_update: "consensus".into(),
|
flag_auto_update: "consensus".into(),
|
||||||
|
flag_no_download: false,
|
||||||
|
flag_no_consensus: false,
|
||||||
flag_chain: "xyz".into(),
|
flag_chain: "xyz".into(),
|
||||||
flag_db_path: "$HOME/.parity".into(),
|
flag_db_path: "$HOME/.parity".into(),
|
||||||
flag_keys_path: "$HOME/.parity/keys".into(),
|
flag_keys_path: "$HOME/.parity/keys".into(),
|
||||||
|
@ -39,8 +39,10 @@ Operating Options:
|
|||||||
(default: {flag_auto_update}).
|
(default: {flag_auto_update}).
|
||||||
--no-download Normally new releases will be downloaded ready for
|
--no-download Normally new releases will be downloaded ready for
|
||||||
updating. This disables it. Not recommended.
|
updating. This disables it. Not recommended.
|
||||||
|
(default: {flag_no_download}).
|
||||||
--no-consensus Force the binary to run even if there are known
|
--no-consensus Force the binary to run even if there are known
|
||||||
issues regarding consensus. Not recommended.
|
issues regarding consensus. Not recommended.
|
||||||
|
(default: {flag_no_consensus}).
|
||||||
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
||||||
JSON chain specification file or olympic, frontier,
|
JSON chain specification file or olympic, frontier,
|
||||||
homestead, mainnet, morden, ropsten, classic, expanse,
|
homestead, mainnet, morden, ropsten, classic, expanse,
|
||||||
|
@ -23,7 +23,7 @@ use cli::{Args, ArgsError};
|
|||||||
use util::{Hashable, U256, Uint, Bytes, version_data, Secret, Address};
|
use util::{Hashable, U256, Uint, Bytes, version_data, Secret, Address};
|
||||||
use util::log::Colour;
|
use util::log::Colour;
|
||||||
use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP};
|
use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP};
|
||||||
use ethcore::client::{VMType, UpdatePolicy};
|
use ethcore::client::{VMType, UpdatePolicy, UpdateFilter};
|
||||||
use ethcore::miner::{MinerOptions, Banning};
|
use ethcore::miner::{MinerOptions, Banning};
|
||||||
|
|
||||||
use rpc::{IpcConfiguration, HttpConfiguration};
|
use rpc::{IpcConfiguration, HttpConfiguration};
|
||||||
@ -81,6 +81,7 @@ impl Configuration {
|
|||||||
let pruning_history = self.args.flag_pruning_history;
|
let pruning_history = self.args.flag_pruning_history;
|
||||||
let vm_type = try!(self.vm_type());
|
let vm_type = try!(self.vm_type());
|
||||||
let mode = match self.args.flag_mode.as_ref() { "last" => None, mode => Some(try!(to_mode(&mode, self.args.flag_mode_timeout, self.args.flag_mode_alarm))), };
|
let mode = match self.args.flag_mode.as_ref() { "last" => None, mode => Some(try!(to_mode(&mode, self.args.flag_mode_timeout, self.args.flag_mode_alarm))), };
|
||||||
|
let update_policy = try!(self.update_policy());
|
||||||
let miner_options = try!(self.miner_options());
|
let miner_options = try!(self.miner_options());
|
||||||
let logger_config = self.logger_config();
|
let logger_config = self.logger_config();
|
||||||
let http_conf = try!(self.http_config());
|
let http_conf = try!(self.http_config());
|
||||||
@ -233,6 +234,7 @@ impl Configuration {
|
|||||||
acc_conf: try!(self.accounts_config()),
|
acc_conf: try!(self.accounts_config()),
|
||||||
gas_pricer: try!(self.gas_pricer_config()),
|
gas_pricer: try!(self.gas_pricer_config()),
|
||||||
miner_extras: try!(self.miner_extras()),
|
miner_extras: try!(self.miner_extras()),
|
||||||
|
update_policy: update_policy,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
tracing: tracing,
|
tracing: tracing,
|
||||||
fat_db: fat_db,
|
fat_db: fat_db,
|
||||||
@ -251,6 +253,7 @@ impl Configuration {
|
|||||||
no_periodic_snapshot: self.args.flag_no_periodic_snapshot,
|
no_periodic_snapshot: self.args.flag_no_periodic_snapshot,
|
||||||
check_seal: !self.args.flag_no_seal_check,
|
check_seal: !self.args.flag_no_seal_check,
|
||||||
download_old_blocks: !self.args.flag_no_ancient_blocks,
|
download_old_blocks: !self.args.flag_no_ancient_blocks,
|
||||||
|
require_consensus: !self.args.flag_no_consensus,
|
||||||
};
|
};
|
||||||
Cmd::Run(run_cmd)
|
Cmd::Run(run_cmd)
|
||||||
};
|
};
|
||||||
@ -586,8 +589,17 @@ impl Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_policy(&self) -> UpdatePolicy {
|
fn update_policy(&self) -> Result<UpdatePolicy, String> {
|
||||||
|
Ok(UpdatePolicy {
|
||||||
|
enable_downloading: !self.args.flag_no_download,
|
||||||
|
filter: match self.args.flag_auto_update.as_ref() {
|
||||||
|
"none" => UpdateFilter::None,
|
||||||
|
"critical" => UpdateFilter::Critical,
|
||||||
|
"patch" => UpdateFilter::Patch,
|
||||||
|
"all" => UpdateFilter::All,
|
||||||
|
_ => return Err("Invalid value for `--auto-update`. See `--help` for more information.".into()),
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn directories(&self) -> Directories {
|
fn directories(&self) -> Directories {
|
||||||
@ -877,6 +889,7 @@ mod tests {
|
|||||||
no_periodic_snapshot: false,
|
no_periodic_snapshot: false,
|
||||||
check_seal: true,
|
check_seal: true,
|
||||||
download_old_blocks: true,
|
download_old_blocks: true,
|
||||||
|
require_consensus: true,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,6 +914,24 @@ mod tests {
|
|||||||
assert_eq!(conf3.miner_options().unwrap(), mining_options);
|
assert_eq!(conf3.miner_options().unwrap(), mining_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_parse_updater_options() {
|
||||||
|
// when
|
||||||
|
let conf0 = parse(&["parity"]);
|
||||||
|
let conf1 = parse(&["parity", "--auto-update", "all"]);
|
||||||
|
let conf2 = parse(&["parity", "--no-download", "--auto-update=patch"]);
|
||||||
|
let conf3 = parse(&["parity", "--auto-update=xxx"]);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert_eq!(conf0.update_policy().unwrap(), UpdatePolicy{enable_downloading: true, filter: UpdateFilter::Critical});
|
||||||
|
mining_options.tx_queue_strategy = PrioritizationStrategy::GasFactorAndGasPrice;
|
||||||
|
assert_eq!(conf1.update_policy().unwrap(), UpdatePolicy{enable_downloading: true, filter: UpdateFilter::All});
|
||||||
|
mining_options.tx_queue_strategy = PrioritizationStrategy::GasPriceOnly;
|
||||||
|
assert_eq!(conf2.update_policy().unwrap(), UpdatePolicy{enable_downloading: false, filter: UpdateFilter::Patch});
|
||||||
|
mining_options.tx_queue_strategy = PrioritizationStrategy::GasAndGasPrice;
|
||||||
|
assert!(conf3.update_policy().is_err());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_parse_network_settings() {
|
fn should_parse_network_settings() {
|
||||||
// given
|
// given
|
||||||
|
@ -20,7 +20,7 @@ use std::time::Duration;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use util::{clean_0x, U256, Uint, Address, path, CompactionProfile};
|
use util::{clean_0x, U256, Uint, Address, path, CompactionProfile};
|
||||||
use util::journaldb::Algorithm;
|
use util::journaldb::Algorithm;
|
||||||
use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
|
use ethcore::client::{UpdatePolicy, Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
|
||||||
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
|
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
|
||||||
use cache::CacheConfig;
|
use cache::CacheConfig;
|
||||||
use dir::DatabaseDirectories;
|
use dir::DatabaseDirectories;
|
||||||
@ -209,6 +209,7 @@ pub fn default_network_config() -> ::ethsync::NetworkConfiguration {
|
|||||||
#[cfg_attr(feature = "dev", allow(too_many_arguments))]
|
#[cfg_attr(feature = "dev", allow(too_many_arguments))]
|
||||||
pub fn to_client_config(
|
pub fn to_client_config(
|
||||||
cache_config: &CacheConfig,
|
cache_config: &CacheConfig,
|
||||||
|
update_policy: UpdatePolicy,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
tracing: bool,
|
tracing: bool,
|
||||||
fat_db: bool,
|
fat_db: bool,
|
||||||
@ -242,6 +243,7 @@ pub fn to_client_config(
|
|||||||
// in bytes
|
// in bytes
|
||||||
client_config.jump_table_size = cache_config.jump_tables() as usize * mb;
|
client_config.jump_table_size = cache_config.jump_tables() as usize * mb;
|
||||||
|
|
||||||
|
client_config.update_policy = update_policy;
|
||||||
client_config.mode = mode;
|
client_config.mode = mode;
|
||||||
client_config.tracing.enabled = tracing;
|
client_config.tracing.enabled = tracing;
|
||||||
client_config.fat_db = fat_db;
|
client_config.fat_db = fat_db;
|
||||||
|
@ -23,7 +23,7 @@ use ethsync::NetworkConfiguration;
|
|||||||
use util::{Colour, version, RotatingLogger};
|
use util::{Colour, version, RotatingLogger};
|
||||||
use io::{MayPanic, ForwardPanic, PanicHandler};
|
use io::{MayPanic, ForwardPanic, PanicHandler};
|
||||||
use ethcore_logger::{Config as LogConfig};
|
use ethcore_logger::{Config as LogConfig};
|
||||||
use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, ChainNotify, BlockChainClient};
|
use ethcore::client::{Mode, UpdatePolicy, DatabaseCompactionProfile, VMType, ChainNotify, BlockChainClient};
|
||||||
use ethcore::service::ClientService;
|
use ethcore::service::ClientService;
|
||||||
use ethcore::account_provider::AccountProvider;
|
use ethcore::account_provider::AccountProvider;
|
||||||
use ethcore::miner::{Miner, MinerService, ExternalMiner, MinerOptions};
|
use ethcore::miner::{Miner, MinerService, ExternalMiner, MinerOptions};
|
||||||
@ -75,6 +75,7 @@ pub struct RunCmd {
|
|||||||
pub acc_conf: AccountsConfig,
|
pub acc_conf: AccountsConfig,
|
||||||
pub gas_pricer: GasPricerConfig,
|
pub gas_pricer: GasPricerConfig,
|
||||||
pub miner_extras: MinerExtras,
|
pub miner_extras: MinerExtras,
|
||||||
|
pub update_policy: UpdatePolicy,
|
||||||
pub mode: Option<Mode>,
|
pub mode: Option<Mode>,
|
||||||
pub tracing: Switch,
|
pub tracing: Switch,
|
||||||
pub fat_db: Switch,
|
pub fat_db: Switch,
|
||||||
@ -92,6 +93,7 @@ pub struct RunCmd {
|
|||||||
pub no_periodic_snapshot: bool,
|
pub no_periodic_snapshot: bool,
|
||||||
pub check_seal: bool,
|
pub check_seal: bool,
|
||||||
pub download_old_blocks: bool,
|
pub download_old_blocks: bool,
|
||||||
|
pub require_consensus: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_ui(dapps_conf: &dapps::Configuration, signer_conf: &signer::Configuration) -> Result<(), String> {
|
pub fn open_ui(dapps_conf: &dapps::Configuration, signer_conf: &signer::Configuration) -> Result<(), String> {
|
||||||
@ -158,6 +160,9 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
|
|||||||
trace!(target: "mode", "mode is {:?}", mode);
|
trace!(target: "mode", "mode is {:?}", mode);
|
||||||
let network_enabled = match &mode { &Mode::Dark(_) | &Mode::Off => false, _ => true, };
|
let network_enabled = match &mode { &Mode::Dark(_) | &Mode::Off => false, _ => true, };
|
||||||
|
|
||||||
|
// get the update policy
|
||||||
|
let update_policy = cmd.update_policy;
|
||||||
|
|
||||||
// prepare client and snapshot paths.
|
// prepare client and snapshot paths.
|
||||||
let client_path = db_dirs.client_path(algorithm);
|
let client_path = db_dirs.client_path(algorithm);
|
||||||
let snapshot_path = db_dirs.snapshot_path();
|
let snapshot_path = db_dirs.snapshot_path();
|
||||||
@ -219,6 +224,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
|
|||||||
// create client config
|
// create client config
|
||||||
let client_config = to_client_config(
|
let client_config = to_client_config(
|
||||||
&cmd.cache_config,
|
&cmd.cache_config,
|
||||||
|
update_policy,
|
||||||
mode,
|
mode,
|
||||||
tracing,
|
tracing,
|
||||||
fat_db,
|
fat_db,
|
||||||
|
@ -170,7 +170,7 @@ impl SnapshotCommand {
|
|||||||
try!(execute_upgrades(&db_dirs, algorithm, self.compaction.compaction_profile(db_dirs.fork_path().as_path())));
|
try!(execute_upgrades(&db_dirs, algorithm, self.compaction.compaction_profile(db_dirs.fork_path().as_path())));
|
||||||
|
|
||||||
// prepare client config
|
// prepare client config
|
||||||
let client_config = to_client_config(&self.cache_config, Mode::Active, tracing, fat_db, self.compaction, self.wal, VMType::default(), "".into(), algorithm, self.pruning_history, true);
|
let client_config = to_client_config(&self.cache_config, Default::default(), Mode::Active, tracing, fat_db, self.compaction, self.wal, VMType::default(), "".into(), algorithm, self.pruning_history, true);
|
||||||
|
|
||||||
let service = try!(ClientService::start(
|
let service = try!(ClientService::start(
|
||||||
client_config,
|
client_config,
|
||||||
|
Loading…
Reference in New Issue
Block a user