-
Notifications
You must be signed in to change notification settings - Fork 169
Use hash_newtype macro instead of the hash256 module #517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a62cb6c to
a2b08e6
Compare
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.
a2b08e6 to
0b482cd
Compare
|
Done! No other changes. |
apoelstra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 0b482cd
sanket1729
left a comment
There was a problem hiding this 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); |
There was a problem hiding this comment.
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.
…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
We currently implement the
hash256::Hashtype manually however there is a macro inbitcoin::hashesthat can do that for us.For context, the
hash256::Hashtype exists solely to enable the type to display forwards sincehashes::sha256ddisplays backwards. Thehash_newtypemacro takes an argument to configure display.