Merge pull request #2471 from ethcore/fix-keys
Fix ethstore opening all key files in the directory at once
This commit is contained in:
commit
eae2466107
@ -76,15 +76,14 @@ impl DiskDirectory {
|
|||||||
.map(|entry| entry.path())
|
.map(|entry| entry.path())
|
||||||
.collect::<Vec<PathBuf>>();
|
.collect::<Vec<PathBuf>>();
|
||||||
|
|
||||||
let files: Result<Vec<_>, _> = paths.iter()
|
paths
|
||||||
.map(fs::File::open)
|
.iter()
|
||||||
.collect();
|
.map(|p| (
|
||||||
|
fs::File::open(p)
|
||||||
let files = try!(files);
|
.map_err(Error::from)
|
||||||
|
.and_then(|r| json::KeyFile::load(r).map_err(|e| Error::Custom(format!("{:?}", e)))),
|
||||||
files.into_iter()
|
p
|
||||||
.map(json::KeyFile::load)
|
))
|
||||||
.zip(paths.into_iter())
|
|
||||||
.map(|(file, path)| match file {
|
.map(|(file, path)| match file {
|
||||||
Ok(file) => Ok((path.clone(), SafeAccount::from_file(
|
Ok(file) => Ok((path.clone(), SafeAccount::from_file(
|
||||||
file, Some(path.file_name().and_then(|n| n.to_str()).expect("Keys have valid UTF8 names only.").to_owned())
|
file, Some(path.file_name().and_then(|n| n.to_str()).expect("Keys have valid UTF8 names only.").to_owned())
|
||||||
|
Loading…
Reference in New Issue
Block a user