Skip to content

Commit cecfdc7

Browse files
committed
Merge #517: Use hash_newtype macro instead of the hash256 module
0b482cd Use hash_newtype macro instead of the hash256 module (Tobin C. Harding) 4eaf261 Fix CI (sanket1729) Pull request description: We currently implement the `hash256::Hash` type manually however there is a macro in `bitcoin::hashes` that can do that for us. For context, the `hash256::Hash` type exists solely to enable the type to display forwards since `hashes::sha256d` displays backwards. The `hash_newtype` macro takes an argument to configure display. ACKs for top commit: apoelstra: ACK 0b482cd sanket1729: ACK 0b482cd Tree-SHA512: 4f5cb44c3fc65b986375565b1c613e99784bfbc5da30542283e39552f986d07ab1876636857d207d9c5d9497719dfcd28ecc1125671f78f171fb041aa770f148
2 parents a0648b3 + 0b482cd commit cecfdc7

File tree

4 files changed

+11
-92
lines changed

4 files changed

+11
-92
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ you may need to pin as follows:
4444
```
4545
cargo update --package url --precise 2.2.2
4646
cargo update --package form_urlencoded --precise 1.0.1
47+
cargo update -p once_cell --precise 1.13.1
48+
cargo update -p bzip2 --precise 0.4.2
4749
```
4850

4951
## Contributing

contrib/test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ if cargo --version | grep "1\.41\.0"; then
1515
cargo update -p url --precise 2.2.2
1616
cargo update -p form_urlencoded --precise 1.0.1
1717
cargo update -p once_cell --precise 1.13.1
18+
cargo update -p bzip2 --precise 0.4.2
1819
fi
1920

2021
# Pin dependencies required to build with Rust 1.47.0

src/miniscript/hash256.rs

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/miniscript/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub mod analyzable;
2727
pub mod astelem;
2828
pub(crate) mod context;
2929
pub mod decode;
30-
pub mod hash256;
3130
pub mod iter;
3231
pub mod lex;
3332
pub mod limits;
@@ -459,6 +458,14 @@ impl_from_str!(
459458

460459
serde_string_impl_pk!(Miniscript, "a miniscript", Ctx; ScriptContext);
461460

461+
/// Provides a Double SHA256 `Hash` type that displays forwards.
462+
pub mod hash256 {
463+
use bitcoin::hashes::{hash_newtype, sha256d};
464+
465+
#[rustfmt::skip]
466+
hash_newtype!(Hash, sha256d::Hash, 32, doc = "A bitcoin block hash.", false);
467+
}
468+
462469
#[cfg(test)]
463470
mod tests {
464471

0 commit comments

Comments
 (0)