Merge branch 'master' into geth-import
This commit is contained in:
commit
94f9501702
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -241,6 +241,7 @@ dependencies = [
|
||||
"serde 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha3 0.1.0",
|
||||
"slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vergen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -692,6 +693,11 @@ dependencies = [
|
||||
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target_info"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "term"
|
||||
version = "0.2.14"
|
||||
|
@ -74,7 +74,7 @@ Options:
|
||||
--peers NUM Try to manintain that many peers [default: 25].
|
||||
--no-discovery Disable new peer discovery.
|
||||
--upnp Use UPnP to try to figure out the correct network settings.
|
||||
--node-key KEY Specify node secret key as hex string.
|
||||
--node-key KEY Specify node secret key, either as 64-character hex string or input to SHA3 operation.
|
||||
|
||||
--cache-pref-size BYTES Specify the prefered size of the blockchain cache in bytes [default: 16384].
|
||||
--cache-max-size BYTES Specify the maximum size of the blockchain cache in bytes [default: 262144].
|
||||
@ -214,17 +214,17 @@ impl Configuration {
|
||||
let mut public_address = None;
|
||||
|
||||
if let Some(ref a) = self.args.flag_address {
|
||||
public_address = Some(SocketAddr::from_str(a.as_ref()).expect("Invalid listen/public address given with --address"));
|
||||
public_address = Some(SocketAddr::from_str(a.as_ref()).unwrap_or_else(|_| die!("{}: Invalid listen/public address given with --address", a)));
|
||||
listen_address = public_address;
|
||||
}
|
||||
if listen_address.is_none() {
|
||||
listen_address = Some(SocketAddr::from_str(self.args.flag_listen_address.as_ref()).expect("Invalid listen address given with --listen-address"));
|
||||
listen_address = Some(SocketAddr::from_str(self.args.flag_listen_address.as_ref()).unwrap_or_else(|_| die!("{}: Invalid listen/public address given with --listen-address", self.args.flag_listen_address)));
|
||||
}
|
||||
if let Some(ref a) = self.args.flag_public_address {
|
||||
if public_address.is_some() {
|
||||
panic!("Conflicting flags: --address and --public-address");
|
||||
die!("Conflicting flags provided: --address and --public-address");
|
||||
}
|
||||
public_address = Some(SocketAddr::from_str(a.as_ref()).expect("Invalid listen address given with --public-address"));
|
||||
public_address = Some(SocketAddr::from_str(a.as_ref()).unwrap_or_else(|_| die!("{}: Invalid listen/public address given with --public-address", a)));
|
||||
}
|
||||
(listen_address, public_address)
|
||||
}
|
||||
@ -236,7 +236,7 @@ impl Configuration {
|
||||
let (listen, public) = self.net_addresses();
|
||||
ret.listen_address = listen;
|
||||
ret.public_address = public;
|
||||
ret.use_secret = self.args.flag_node_key.as_ref().map(|s| Secret::from_str(&s).expect("Invalid key string"));
|
||||
ret.use_secret = self.args.flag_node_key.as_ref().map(|s| Secret::from_str(&s).unwrap_or_else(|_| s.sha3()));
|
||||
ret.discovery_enabled = !self.args.flag_no_discovery;
|
||||
ret.ideal_peers = self.args.flag_peers;
|
||||
let mut net_path = PathBuf::from(&self.path());
|
||||
@ -279,6 +279,7 @@ impl Configuration {
|
||||
|
||||
// Setup rpc
|
||||
if self.args.flag_jsonrpc {
|
||||
SocketAddr::from_str(&self.args.flag_jsonrpc_url).unwrap_or_else(|_|die!("{}: Invalid JSONRPC listen address given with --jsonrpc-url. Should be of the form 'IP:port'.", self.args.flag_jsonrpc_url));
|
||||
setup_rpc_server(service.client(), sync.clone(), &self.args.flag_jsonrpc_url);
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ igd = "0.4.2"
|
||||
ethcore-devtools = { path = "../devtools" }
|
||||
libc = "0.2.7"
|
||||
vergen = "0.1"
|
||||
target_info = "0.1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
@ -108,6 +108,7 @@ extern crate igd;
|
||||
extern crate ethcore_devtools as devtools;
|
||||
extern crate libc;
|
||||
extern crate rustc_version;
|
||||
extern crate target_info;
|
||||
extern crate vergen;
|
||||
|
||||
pub mod standard;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
use std::fs::File;
|
||||
use common::*;
|
||||
use target_info::Target;
|
||||
use rustc_version;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||
@ -68,5 +69,5 @@ pub fn contents(name: &str) -> Result<Bytes, UtilError> {
|
||||
|
||||
/// Get the standard version string for this software.
|
||||
pub fn version() -> String {
|
||||
format!("Parity/{}/{}-{}/{}/rustc{}", env!("CARGO_PKG_VERSION"), short_sha(), commit_date(), target(), rustc_version::version())
|
||||
format!("Parity//{}-{}-{}/{}-{}-{}/rustc{}", env!("CARGO_PKG_VERSION"), short_sha(), commit_date().replace("-", ""), Target::arch(), Target::os(), Target::env(), rustc_version::version())
|
||||
}
|
@ -276,9 +276,6 @@ impl Discovery {
|
||||
}
|
||||
|
||||
pub fn writable(&mut self) {
|
||||
if self.send_queue.is_empty() {
|
||||
return;
|
||||
}
|
||||
while !self.send_queue.is_empty() {
|
||||
let data = self.send_queue.pop_front().unwrap();
|
||||
match self.udp_socket.send_to(&data.payload, &data.address) {
|
||||
|
@ -163,7 +163,7 @@ impl Display for Node {
|
||||
impl FromStr for Node {
|
||||
type Err = UtilError;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let (id, endpoint) = if &s[0..8] == "enode://" && s.len() > 136 && &s[136..137] == "@" {
|
||||
let (id, endpoint) = if s.len() > 136 && &s[0..8] == "enode://" && &s[136..137] == "@" {
|
||||
(try!(NodeId::from_str(&s[8..136])), try!(NodeEndpoint::from_str(&s[137..])))
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user