Skip to content

Commit

Permalink
move rng call pre matchblock to gen fresh ephemeral for both cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Lederstrumpf committed Dec 20, 2021
1 parent efe92ec commit 6304c5d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/peerd/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,10 @@ impl PeerKeyOpts {

pub fn node_secrets(&self, opt_secret_key: Option<SecretKey>) -> PeerSecrets {
let mut rng = thread_rng();
rng.next_u64();
let secret_key = match opt_secret_key {
Some(secret_key) => secret_key,
None => {
rng.next_u64();
SecretKey::new(&mut rng)
}
None => SecretKey::new(&mut rng),
};
let ephemeral_secret_key = SecretKey::new(&mut rng);
let local_node = LocalNode::from_keys(secret_key, ephemeral_secret_key);
Expand Down

0 comments on commit 6304c5d

Please sign in to comment.