Skip to content

Commit 7c58ae9

Browse files
committed
new random should also use from_seed
1 parent 389b3f2 commit 7c58ae9

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/account.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,14 @@ impl MasterAccount {
7474
network: Network,
7575
passphrase: &str,
7676
) -> Result<MasterAccount, Error> {
77-
let context = SecpContext::new();
7877
let mut random = vec![0u8; entropy as usize];
7978
thread_rng().fill_bytes(random.as_mut_slice());
8079
let seed = Seed(random);
81-
let encrypted = seed.encrypt(passphrase)?;
82-
let master_key = context.master_private_key(network, &seed)?;
83-
let public_master_key = context.extended_public_from_private(&master_key);
8480
let now = SystemTime::now()
8581
.duration_since(UNIX_EPOCH)
8682
.unwrap()
8783
.as_secs();
88-
Ok(MasterAccount {
89-
master_public: public_master_key,
90-
encrypted,
91-
accounts: HashMap::new(),
92-
birth: now,
93-
})
84+
Self::from_seed(&seed, now, network, passphrase)
9485
}
9586

9687
/// Restore from encrypted store

0 commit comments

Comments
 (0)