TIL that `secp256k1_context_randomize` actually requires a signing context, despite the docs not mentioning this. See https://github.com/bitcoin-core/secp256k1/issues/573 The following code can trigger a process abort in a unit test (run with `cargo test --features "rand"`) ``` diff --git a/src/lib.rs b/src/lib.rs index 81cbc57..2b0a4a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1179,6 +1179,13 @@ mod tests { assert_tokens(&sig, &[Token::BorrowedBytes(&SIG_BYTES[..])]); } + + #[cfg(feature="rand")] + #[test] + fn test_randomize() { + let mut s = Secp256k1::verification_only(); + s.randomize(&mut ::rand::thread_rng()); + } } #[cfg(all(test, feature = "unstable"))] ```