Merge branch 'lightsync' into on-demand-les-request

This commit is contained in:
Robert Habermeier 2017-01-04 15:18:22 +01:00
commit 5060370c70
4 changed files with 1 additions and 72 deletions

View File

@ -94,7 +94,6 @@ usage! {
flag_db_path: String = "$BASE/chains", or |c: &Config| otry!(c.parity).db_path.clone(), flag_db_path: String = "$BASE/chains", or |c: &Config| otry!(c.parity).db_path.clone(),
flag_keys_path: String = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(), flag_keys_path: String = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(),
flag_identity: String = "", or |c: &Config| otry!(c.parity).identity.clone(), flag_identity: String = "", or |c: &Config| otry!(c.parity).identity.clone(),
flag_light: bool = false, or |c: &Config| otry!(c.parity).light.clone(),
// -- Account Options // -- Account Options
flag_unlock: Option<String> = None, flag_unlock: Option<String> = None,
@ -322,7 +321,6 @@ struct Operating {
db_path: Option<String>, db_path: Option<String>,
keys_path: Option<String>, keys_path: Option<String>,
identity: Option<String>, identity: Option<String>,
light: Option<bool>,
} }
#[derive(Default, Debug, PartialEq, RustcDecodable)] #[derive(Default, Debug, PartialEq, RustcDecodable)]
@ -551,7 +549,6 @@ mod tests {
flag_db_path: "$HOME/.parity/chains".into(), flag_db_path: "$HOME/.parity/chains".into(),
flag_keys_path: "$HOME/.parity/keys".into(), flag_keys_path: "$HOME/.parity/keys".into(),
flag_identity: "".into(), flag_identity: "".into(),
flag_light: false,
// -- Account Options // -- Account Options
flag_unlock: Some("0xdeadbeefcafe0000000000000000000000000000".into()), flag_unlock: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
@ -730,7 +727,6 @@ mod tests {
db_path: None, db_path: None,
keys_path: None, keys_path: None,
identity: None, identity: None,
light: None,
}), }),
account: Some(Account { account: Some(Account {
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]), unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),

View File

@ -66,8 +66,6 @@ Operating Options:
--keys-path PATH Specify the path for JSON key files to be found --keys-path PATH Specify the path for JSON key files to be found
(default: {flag_keys_path}). (default: {flag_keys_path}).
--identity NAME Specify your node's name. (default: {flag_identity}) --identity NAME Specify your node's name. (default: {flag_identity})
--light Run in light client mode. Very experimental.
(default: {flag_light})
Account Options: Account Options:
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution. --unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.

View File

@ -341,7 +341,6 @@ 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,
light: self.args.flag_light,
verifier_settings: verifier_settings, verifier_settings: verifier_settings,
}; };
Cmd::Run(run_cmd) Cmd::Run(run_cmd)
@ -1033,7 +1032,6 @@ mod tests {
check_seal: true, check_seal: true,
download_old_blocks: true, download_old_blocks: true,
verifier_settings: Default::default(), verifier_settings: Default::default(),
light: false,
})); }));
} }

View File

@ -32,7 +32,7 @@ use ethcore::verification::queue::VerifierSettings;
use ethsync::SyncConfig; use ethsync::SyncConfig;
use informant::Informant; use informant::Informant;
use updater::{UpdatePolicy, Updater}; use updater::{UpdatePolicy, Updater};
use parity_reactor::{EventLoop, EventLoopHandle}; use parity_reactor::EventLoop;
use hash_fetch::fetch::{Fetch, Client as FetchClient}; use hash_fetch::fetch::{Fetch, Client as FetchClient};
use rpc::{HttpConfiguration, IpcConfiguration}; use rpc::{HttpConfiguration, IpcConfiguration};
@ -96,7 +96,6 @@ pub struct RunCmd {
pub check_seal: bool, pub check_seal: bool,
pub download_old_blocks: bool, pub download_old_blocks: bool,
pub verifier_settings: VerifierSettings, pub verifier_settings: VerifierSettings,
pub light: 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> {
@ -116,64 +115,6 @@ pub fn open_ui(dapps_conf: &dapps::Configuration, signer_conf: &signer::Configur
Ok(()) Ok(())
} }
// Execute in light client mode.
pub fn execute_light(cmd: RunCmd) -> Result<bool, String> {
use light::client::{Config as ClientConfig, Service as LightClientService};
use ethsync::{LightSync, LightSyncParams, ManageNetwork};
let panic_handler = PanicHandler::new_in_arc();
info!(
"Configured in {} mode. Note that this feature is {}.",
Colour::Blue.bold().paint("Light Client"),
Colour::Red.bold().paint("experimental"),
);
let mut client_config = ClientConfig::default();
let queue_size = cmd.cache_config.queue();
client_config.queue.max_queue_size = queue_size as usize;
client_config.queue.verifier_settings = cmd.verifier_settings;
let spec = try!(cmd.spec.spec());
let service = try!(LightClientService::start(client_config, &spec)
.map_err(|e| format!("Error starting light client service: {}", e)));
let net_conf = try!(cmd.net_conf.into_basic()
.map_err(|e| format!("Failed to create network config: {}", e)));
let sync_params = LightSyncParams {
network_config: net_conf,
client: service.client().clone(),
network_id: cmd.network_id.unwrap_or(spec.network_id()),
subprotocol_name: *b"les",
};
let sync = try!(LightSync::new(sync_params)
.map_err(|e| format!("Failed to initialize sync service: {}", e)));
sync.start_network();
let log_client = service.client().clone();
::std::thread::spawn(move || {
// TODO: proper informant.
loop {
::std::thread::sleep(::std::time::Duration::from_secs(5));
let chain_info = log_client.chain_info();
let queue_info = log_client.queue_info();
println!(
"#{} {:5}+{:5} Qed",
chain_info.best_block_number,
queue_info.unverified_queue_size,
queue_info.verified_queue_size
);
}
});
wait_for_exit(panic_handler, None, false);
Ok(false)
}
pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<bool, String> { pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<bool, String> {
if cmd.ui && cmd.dapps_conf.enabled { if cmd.ui && cmd.dapps_conf.enabled {
// Check if Parity is already running // Check if Parity is already running
@ -183,10 +124,6 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
} }
} }
if cmd.light {
return execute_light(cmd);
}
// set up panic handler // set up panic handler
let panic_handler = PanicHandler::new_in_arc(); let panic_handler = PanicHandler::new_in_arc();