Skip to content

Conversation

@tcharding
Copy link
Member

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.

@tcharding tcharding force-pushed the 01-10-hash256 branch 2 times, most recently from a62cb6c to a2b08e6 Compare January 10, 2023 05:29
@sanket1729
Copy link
Member

can you cherry-pick this commit 62219d4 from #516? That should Fix CI

sanket1729 and others added 2 commits January 12, 2023 10:25
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.
@tcharding
Copy link
Member Author

Done! No other changes.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 0b482cd

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 0b482cd

use bitcoin::hashes::{hash_newtype, sha256d};

#[rustfmt::skip]
hash_newtype!(Hash, sha256d::Hash, 32, doc = "A bitcoin block hash.", false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this now to fix the CI. But we should update the doc-comment to reflect that this is just double-hashed sha256::Hash with display forward and not a bitcoin block hash.

@sanket1729 sanket1729 merged commit cecfdc7 into rust-bitcoin:master Jan 14, 2023
@tcharding tcharding deleted the 01-10-hash256 branch February 21, 2023 04:11
heap-coder added a commit to heap-coder/rust-miniscript that referenced this pull request Sep 27, 2025
…d of the hash256 module

0b482cd755e3d7c693fffe54849f31204269d45a Use hash_newtype macro instead of the hash256 module (Tobin C. Harding)
4eaf2611e464e0169c36b9a926fac6fed5d6edf5 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 0b482cd755e3d7c693fffe54849f31204269d45a
  sanket1729:
    ACK 0b482cd755e3d7c693fffe54849f31204269d45a

Tree-SHA512: 4f5cb44c3fc65b986375565b1c613e99784bfbc5da30542283e39552f986d07ab1876636857d207d9c5d9497719dfcd28ecc1125671f78f171fb041aa770f148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants