Skip to content

Commit 0b482cd

Browse files
committed
Use hash_newtype macro instead of the hash256 module
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.
1 parent 4eaf261 commit 0b482cd

File tree

2 files changed

+8
-92
lines changed

2 files changed

+8
-92
lines changed

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)