Merge pull request #3378 from ethcore/fix-wallet-naming

Wallet files shouldn't give away the address
This commit is contained in:
Gav Wood 2016-11-17 18:30:04 +08:00 committed by GitHub
commit 64a4b60857

View File

@ -20,6 +20,7 @@ use std::collections::HashMap;
use time; use time;
use ethkey::Address; use ethkey::Address;
use {json, SafeAccount, Error}; use {json, SafeAccount, Error};
use json::UUID;
use super::KeyDirectory; use super::KeyDirectory;
const IGNORED_FILES: &'static [&'static str] = &["thumbs.db", "address_book.json"]; const IGNORED_FILES: &'static [&'static str] = &["thumbs.db", "address_book.json"];
@ -112,7 +113,7 @@ impl KeyDirectory for DiskDirectory {
// build file path // build file path
let filename = account.filename.as_ref().cloned().unwrap_or_else(|| { let filename = account.filename.as_ref().cloned().unwrap_or_else(|| {
let timestamp = time::strftime("%Y-%m-%dT%H-%M-%S", &time::now_utc()).expect("Time-format string is valid."); let timestamp = time::strftime("%Y-%m-%dT%H-%M-%S", &time::now_utc()).expect("Time-format string is valid.");
format!("UTC--{}Z--{:?}", timestamp, account.address) format!("UTC--{}Z--{}", timestamp, UUID::from(account.id))
}); });
// update account filename // update account filename