Skip to content

Commit 7a3736a

Browse files
committed
Merge #389: On key-generation example (documentation), "rand" should be "rand-std" instead
2732891 Change rand to rand-std in lib.rs documentation (Vincent Liao) Pull request description: I copy-pasted the key-generation example written on the documentation, but it didn't work. It only worked when I used the feature `rand-std` instead of `rand`. To reproduce, boot up a new Rust project, and add this to main.rs: ``` use secp256k1::rand::rngs::OsRng; use secp256k1::{Secp256k1, Message}; use secp256k1::hashes::sha256; let secp = Secp256k1::new(); let mut rng = OsRng::new().expect("OsRng"); let (secret_key, public_key) = secp.generate_keypair(&mut rng); let message = Message::from_hashed_data::<sha256::Hash>("Hello World!".as_bytes()); let sig = secp.sign_ecdsa(&message, &secret_key); assert!(secp.verify_ecdsa(&message, &sig, &public_key).is_ok()); ``` Using this dependencies causes error: `secp256k1 = {version="0.21.2", features=["rand", "bitcoin_hashes"]}`. After replacing `rand` with `rand-std`, it works. ACKs for top commit: apoelstra: ACK 2732891 tcharding: tACK 2732891 Tree-SHA512: 6b5436bc71bab7535e432e119679bc6bcb11d2575b609e039cc25c122ae92b528f95a673e9c643a6cfa2ee3a663f7efdd61731b6084261c52a220448b6f72d12
2 parents 9b5c509 + 2732891 commit 7a3736a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
//! # }
5454
//! ```
5555
//!
56-
//! The above code requires `rust-secp256k1` to be compiled with the `rand` and `bitcoin_hashes`
56+
//! The above code requires `rust-secp256k1` to be compiled with the `rand-std` and `bitcoin_hashes`
5757
//! feature enabled, to get access to [`generate_keypair`](struct.Secp256k1.html#method.generate_keypair)
5858
//! Alternately, keys and messages can be parsed from slices, like
5959
//!

0 commit comments

Comments
 (0)