Minor refactor.

This commit is contained in:
Gav Wood 2016-03-27 01:41:28 +01:00
parent 53c4ed09a3
commit 8805d04183

View File

@ -498,18 +498,15 @@ impl Configuration {
} }
} }
fn passwords(&self) -> Vec<String> { fn account_service(&self) -> AccountService {
self.args.flag_password.iter().map(|filename| { // Secret Store
let passwords = self.args.flag_password.iter().map(|filename| {
let mut buffer = String::new(); let mut buffer = String::new();
File::open(filename).and_then(|mut f| f.read_to_string(&mut buffer)).unwrap_or_else(|_| die!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename)); File::open(filename).and_then(|mut f| f.read_to_string(&mut buffer)).unwrap_or_else(|_| die!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename));
buffer buffer
}).collect() }).collect::<Vec<_>>();
}
fn account_service(&self) -> AccountService {
// Secret Store
let account_service = AccountService::new(); let account_service = AccountService::new();
let passwords = self.passwords();
for d in &self.args.flag_unlock { for d in &self.args.flag_unlock {
let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| { let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| {
die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d) die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d)