Merge branch 'master' into path-man

Conflicts:
	parity/configuration.rs
This commit is contained in:
Nikolay Volf
2016-05-14 20:22:59 +03:00
19 changed files with 85 additions and 44 deletions

View File

@@ -42,6 +42,9 @@ Account Options:
ACCOUNTS is a comma-delimited list of addresses.
--password FILE Provide a file containing a password for unlocking
an account.
--keys-iterations NUM Specify the number of iterations to use when deriving key
from the password (bigger is more secure)
[default: 10240].
Networking Options:
--port PORT Override the port on which the node should listen
@@ -182,6 +185,7 @@ pub struct Args {
pub flag_password: Vec<String>,
pub flag_cache: Option<usize>,
pub flag_keys_path: String,
pub flag_keys_iterations: u32,
pub flag_bootnodes: Option<String>,
pub flag_network_id: Option<String>,
pub flag_pruning: String,

View File

@@ -241,7 +241,7 @@ impl Configuration {
.collect::<Vec<_>>()
.into_iter()
}).collect::<Vec<_>>();
let account_service = AccountService::new_in(Path::new(&self.keys_path()));
let account_service = AccountService::with_security(Path::new(&self.keys_path()), self.keys_iterations());
if let Some(ref unlocks) = self.args.flag_unlock {
for d in unlocks.split(',') {
let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| {
@@ -259,8 +259,9 @@ impl Configuration {
self.args.flag_rpcapi.clone().unwrap_or(self.args.flag_jsonrpc_apis.clone())
}
pub fn rpc_cors(&self) -> Option<String> {
self.args.flag_jsonrpc_cors.clone().or(self.args.flag_rpccorsdomain.clone())
pub fn rpc_cors(&self) -> Vec<String> {
let cors = self.args.flag_jsonrpc_cors.clone().or(self.args.flag_rpccorsdomain.clone());
cors.map_or_else(Vec::new, |c| c.split(',').map(|s| s.to_owned()).collect())
}
fn geth_ipc_path() -> String {
@@ -360,7 +361,7 @@ mod tests {
assert_eq!(net.rpc_enabled, true);
assert_eq!(net.rpc_interface, "all".to_owned());
assert_eq!(net.rpc_port, 8000);
assert_eq!(conf.rpc_cors(), Some("*".to_owned()));
assert_eq!(conf.rpc_cors(), vec!["*".to_owned()]);
assert_eq!(conf.rpc_apis(), "web3,eth".to_owned());
}

View File

@@ -219,7 +219,7 @@ fn flush_stdout() {
fn execute_account_cli(conf: Configuration) {
use util::keys::store::SecretStore;
use rpassword::read_password;
let mut secret_store = SecretStore::new_in(Path::new(&conf.keys_path()));
let mut secret_store = SecretStore::with_security(Path::new(&conf.keys_path()), conf.keys_iterations());
if conf.args.cmd_new {
println!("Please note that password is NOT RECOVERABLE.");
print!("Type password: ");

View File

@@ -41,7 +41,7 @@ pub struct HttpConfiguration {
pub interface: String,
pub port: u16,
pub apis: String,
pub cors: Option<String>,
pub cors: Vec<String>,
}
pub struct IpcConfiguration {
@@ -139,11 +139,11 @@ pub fn setup_http_rpc_server(
pub fn setup_http_rpc_server(
dependencies: &Arc<Dependencies>,
url: &SocketAddr,
cors_domain: Option<String>,
cors_domains: Vec<String>,
apis: Vec<&str>,
) -> RpcServer {
let server = setup_rpc_server(apis, dependencies);
let start_result = server.start_http(url, cors_domain);
let start_result = server.start_http(url, cors_domains);
let deps = dependencies.clone();
match start_result {
Err(RpcServerError::IoError(err)) => die_with_io_error("RPC", err),