From dc3ceeb5bb89d731d9ad2b0bf2431d76cabd84c0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 19 Feb 2016 20:02:23 +0100 Subject: [PATCH] Use new is_valid_node_url function. --- Cargo.lock | 1 - parity/main.rs | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d475f81e1..250acb5a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,6 @@ dependencies = [ "ethsync 0.9.99", "fdlimit 0.1.0", "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/parity/main.rs b/parity/main.rs index 8930c60e9..58d3a6f4c 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -31,21 +31,18 @@ extern crate ctrlc; extern crate fdlimit; extern crate target_info; extern crate daemonize; -extern crate regex; #[cfg(feature = "rpc")] extern crate ethcore_rpc as rpc; use std::net::{SocketAddr}; use std::env; -use std::from_str::FromStr; use std::process::exit; use std::path::PathBuf; use rlog::{LogLevelFilter}; use env_logger::LogBuilder; use ctrlc::CtrlC; use util::*; -use util::network::node::Node; use util::panics::MayPanic; use ethcore::spec::*; use ethcore::client::*; @@ -56,7 +53,6 @@ use ethsync::EthSync; use docopt::Docopt; use target_info::Target; use daemonize::Daemonize; -use regex::Regex; const USAGE: &'static str = " Parity. Ethereum Client. @@ -199,7 +195,10 @@ impl Configuration { } fn normalize_enode(e: &str) -> Option { - Node::from_str(e).ok().map(|_| e.to_owned()) + match is_valid_node_url(e) { + true => Some(e.to_owned()), + false => None, + } } fn init_nodes(&self, spec: &Spec) -> Vec { @@ -244,6 +243,7 @@ impl Configuration { let mut net_path = PathBuf::from(&self.path()); net_path.push("network"); ret.config_path = Some(net_path.to_str().unwrap().to_owned()); + ret } fn execute(&self) {