context: unconditionally disable auto-rerandomization on wasm
This causes panics. We can't add catch the panic, we can't change its output, we can't detect if it'll happen, etc. Rather than dealing with confused bug reports let's just drop this. If users want to rerandomize their contexts they can do so manually. There is probably a better solution to this but it is still under debate, even upstream in the C library, what this should look like. Meanwhile we have bug reports now.
This commit is contained in:
parent
748284633b
commit
b01337cfb5
|
@ -47,7 +47,7 @@ pub mod global {
|
||||||
static mut CONTEXT: Option<Secp256k1<All>> = None;
|
static mut CONTEXT: Option<Secp256k1<All>> = None;
|
||||||
ONCE.call_once(|| unsafe {
|
ONCE.call_once(|| unsafe {
|
||||||
let mut ctx = Secp256k1::new();
|
let mut ctx = Secp256k1::new();
|
||||||
#[cfg(all(feature = "rand-std", not(feature = "global-context-less-secure")))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "rand-std", not(feature = "global-context-less-secure")))]
|
||||||
{
|
{
|
||||||
ctx.randomize(&mut rand::thread_rng());
|
ctx.randomize(&mut rand::thread_rng());
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ mod alloc_only {
|
||||||
size,
|
size,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(all(feature = "rand-std", not(feature = "global-context-less-secure")))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "rand-std", not(feature = "global-context-less-secure")))]
|
||||||
{
|
{
|
||||||
ctx.randomize(&mut rand::thread_rng());
|
ctx.randomize(&mut rand::thread_rng());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue