Use new is_valid_node_url function.

This commit is contained in:
Gav Wood 2016-02-19 20:02:23 +01:00
parent 5f164e1c98
commit dc3ceeb5bb
2 changed files with 5 additions and 6 deletions

1
Cargo.lock generated
View File

@ -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)",
]

View File

@ -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<String> {
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<String> {
@ -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) {