Skip to content

Commit 4adbbce

Browse files
committed
Merge #563: change bitcoin-hashes feature gates to bitcoin_hashes
1d6a46e change bitcoin-hashes feature gates to bitcoin_hashes (Andrew Poelstra) Pull request description: This leaves `bitcoin-hashes` in place everywhere in the documentation, but changes it to `bitcoin_hashes` on the actual feature gates, to ensure that both flags work. It's unfortunately a bit hard to test this because the library will be self-consistent pretty-much no matter what we do ... the issue is if the user enables the wrong flag we want to make sure that all the APIs we intend to be visible are actually visible. Fixes #562. ACKs for top commit: tcharding: ACK 1d6a46e Tree-SHA512: 1e060aeb2810ef1e23cf5c956023aca586550ba0287bbf7bc1108dc14091e17d7601aac3f057d0313fafd21351cdda1b08b4250f34ecde917be686d0b739e65a
2 parents 29c1363 + 1d6a46e commit 4adbbce

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/key.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::Error::{self, InvalidPublicKey, InvalidPublicKeySum, InvalidSecretKey
3131
use crate::{constants, from_hex, Scalar, Secp256k1, Signing, Verification};
3232
#[cfg(feature = "global-context")]
3333
use crate::{ecdsa, Message, SECP256K1};
34-
#[cfg(feature = "bitcoin-hashes")]
34+
#[cfg(feature = "bitcoin_hashes")]
3535
use crate::{hashes, ThirtyTwoByteHash};
3636

3737
/// Secret 256-bit key used as `x` in an ECDSA signature.
@@ -284,7 +284,7 @@ impl SecretKey {
284284
/// assert_eq!(sk1, sk2);
285285
/// # }
286286
/// ```
287-
#[cfg(feature = "bitcoin-hashes")]
287+
#[cfg(feature = "bitcoin_hashes")]
288288
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
289289
#[inline]
290290
pub fn from_hashed_data<H: ThirtyTwoByteHash + hashes::Hash>(data: &[u8]) -> Self {
@@ -383,7 +383,7 @@ impl SecretKey {
383383
}
384384
}
385385

386-
#[cfg(feature = "bitcoin-hashes")]
386+
#[cfg(feature = "bitcoin_hashes")]
387387
impl<T: ThirtyTwoByteHash> From<T> for SecretKey {
388388
/// Converts a 32-byte hash directly to a secret key without error paths.
389389
fn from(t: T) -> SecretKey {

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@
140140
//! * `alloc` - use the `alloc` standard Rust library to provide heap allocations.
141141
//! * `rand` - use `rand` library to provide random generator (e.g. to generate keys).
142142
//! * `rand-std` - use `rand` library with its `std` feature enabled. (Implies `rand`.)
143-
//! * `bitcoin-hashes` - use the `bitcoin-hashes` library.
144-
//! * `bitcoin-hashes-std` - use the `bitcoin-hashes` library with its `std` feature enabled (implies `bitcoin-hashes`).
143+
//! * `bitcoin-hashes` - use the `bitcoin_hashes` library.
144+
//! * `bitcoin-hashes-std` - use the `bitcoin_hashes` library with its `std` feature enabled (implies `bitcoin-hashes`).
145145
//! * `recovery` - enable functions that can compute the public key from signature.
146146
//! * `lowmemory` - optimize the library for low-memory environments.
147147
//! * `global-context` - enable use of global secp256k1 context (implies `std`).
@@ -183,7 +183,7 @@ use core::marker::PhantomData;
183183
use core::ptr::NonNull;
184184
use core::{fmt, mem, str};
185185

186-
#[cfg(feature = "bitcoin-hashes")]
186+
#[cfg(feature = "bitcoin_hashes")]
187187
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
188188
pub use bitcoin_hashes as hashes;
189189
#[cfg(feature = "global-context")]
@@ -200,7 +200,7 @@ pub use serde;
200200
pub use crate::context::*;
201201
use crate::ffi::types::AlignedType;
202202
use crate::ffi::CPtr;
203-
#[cfg(feature = "bitcoin-hashes")]
203+
#[cfg(feature = "bitcoin_hashes")]
204204
use crate::hashes::Hash;
205205
pub use crate::key::{PublicKey, SecretKey, *};
206206
pub use crate::scalar::Scalar;
@@ -213,19 +213,19 @@ pub trait ThirtyTwoByteHash {
213213
fn into_32(self) -> [u8; 32];
214214
}
215215

216-
#[cfg(feature = "bitcoin-hashes")]
216+
#[cfg(feature = "bitcoin_hashes")]
217217
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
218218
impl ThirtyTwoByteHash for hashes::sha256::Hash {
219219
fn into_32(self) -> [u8; 32] { self.into_inner() }
220220
}
221221

222-
#[cfg(feature = "bitcoin-hashes")]
222+
#[cfg(feature = "bitcoin_hashes")]
223223
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
224224
impl ThirtyTwoByteHash for hashes::sha256d::Hash {
225225
fn into_32(self) -> [u8; 32] { self.into_inner() }
226226
}
227227

228-
#[cfg(feature = "bitcoin-hashes")]
228+
#[cfg(feature = "bitcoin_hashes")]
229229
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
230230
impl<T: hashes::sha256t::Tag> ThirtyTwoByteHash for hashes::sha256t::Hash<T> {
231231
fn into_32(self) -> [u8; 32] { self.into_inner() }
@@ -263,7 +263,7 @@ impl Message {
263263
/// # Examples
264264
///
265265
/// ```
266-
/// # #[cfg(feature = "bitcoin-hashes")] {
266+
/// # #[cfg(feature = "bitcoin_hashes")] {
267267
/// use secp256k1::hashes::{sha256, Hash};
268268
/// use secp256k1::Message;
269269
///
@@ -274,7 +274,7 @@ impl Message {
274274
/// assert_eq!(m1, m2);
275275
/// # }
276276
/// ```
277-
#[cfg(feature = "bitcoin-hashes")]
277+
#[cfg(feature = "bitcoin_hashes")]
278278
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
279279
pub fn from_hashed_data<H: ThirtyTwoByteHash + hashes::Hash>(data: &[u8]) -> Self {
280280
<H as hashes::Hash>::hash(data).into()
@@ -1037,7 +1037,7 @@ mod tests {
10371037
assert!(SECP256K1.verify_ecdsa(&msg, &sig, &pk).is_ok());
10381038
}
10391039

1040-
#[cfg(feature = "bitcoin-hashes")]
1040+
#[cfg(feature = "bitcoin_hashes")]
10411041
#[test]
10421042
fn test_from_hash() {
10431043
use crate::hashes::{self, Hash};

src/secret.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ macro_rules! impl_display_secret {
4545
}
4646
}
4747

48-
#[cfg(all(not(feature = "std"), feature = "bitcoin-hashes"))]
48+
#[cfg(all(not(feature = "std"), feature = "bitcoin_hashes"))]
4949
impl ::core::fmt::Debug for $thing {
5050
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
5151
use crate::hashes::{sha256, Hash, HashEngine};
@@ -63,7 +63,7 @@ macro_rules! impl_display_secret {
6363
}
6464
}
6565

66-
#[cfg(all(not(feature = "std"), not(feature = "bitcoin-hashes")))]
66+
#[cfg(all(not(feature = "std"), not(feature = "bitcoin_hashes")))]
6767
impl ::core::fmt::Debug for $thing {
6868
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
6969
write!(f, "<secret requires std or bitcoin_hashes feature to display>")

0 commit comments

Comments
 (0)