Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymar committed Dec 11, 2024
1 parent 78c0e8e commit 995389f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test-utils/src/simple_rng.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use bitcoin::{
secp256k1,
secp256k1::{constants::SECRET_KEY_SIZE, Secp256k1, Signing},
};
use bitcoin::secp256k1::{constants::SECRET_KEY_SIZE, PublicKey, Secp256k1, SecretKey, Signing};
use std::cell::RefCell;

thread_local! {
Expand All @@ -18,14 +15,12 @@ where
})
}

pub fn generate_keypair<C: Signing>(
secp: &Secp256k1<C>,
) -> (secp256k1::SecretKey, secp256k1::PublicKey) {
pub fn generate_keypair<C: Signing>(secp: &Secp256k1<C>) -> (SecretKey, PublicKey) {
with_rng(|rng| {
let mut data = [0u8; SECRET_KEY_SIZE];
rng.fill_bytes(&mut data);
let sk = secp256k1::SecretKey::from_slice(&data).unwrap();
let pk = secp256k1::PublicKey::from_secret_key(secp, &sk);
let sk = SecretKey::from_slice(&data).unwrap();
let pk = PublicKey::from_secret_key(secp, &sk);
(sk, pk)
})
}
Expand Down

0 comments on commit 995389f

Please sign in to comment.