Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2471 from ethcore/fix-keys
Browse files Browse the repository at this point in the history
Fix ethstore opening all key files in the directory at once
  • Loading branch information
arkpar authored Oct 5, 2016
2 parents 1782b65 + eddfb47 commit eae2466
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ethstore/src/dir/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ impl DiskDirectory {
.map(|entry| entry.path())
.collect::<Vec<PathBuf>>();

let files: Result<Vec<_>, _> = paths.iter()
.map(fs::File::open)
.collect();

let files = try!(files);

files.into_iter()
.map(json::KeyFile::load)
.zip(paths.into_iter())
paths
.iter()
.map(|p| (
fs::File::open(p)
.map_err(Error::from)
.and_then(|r| json::KeyFile::load(r).map_err(|e| Error::Custom(format!("{:?}", e)))),
p
))
.map(|(file, path)| match 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())
Expand Down

0 comments on commit eae2466

Please sign in to comment.