Skip to content

Commit

Permalink
fix: don't randomize the global context twice
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Nov 1, 2024
1 parent bb4972f commit b7b999e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,7 @@ pub mod global {
static ONCE: Once = Once::new();
static mut CONTEXT: Option<Secp256k1<All>> = None;
ONCE.call_once(|| unsafe {
let mut ctx = Secp256k1::new();
#[cfg(all(
not(target_arch = "wasm32"),
feature = "rand",
feature = "std",
not(feature = "global-context-less-secure")
))]
{
ctx.randomize(&mut rand::thread_rng());
}
CONTEXT = Some(ctx);
CONTEXT = Some(Secp256k1::new());
});
unsafe { CONTEXT.as_ref().unwrap() }
}
Expand Down

0 comments on commit b7b999e

Please sign in to comment.