-
Notifications
You must be signed in to change notification settings - Fork 280
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
Deprecate Message::from_digest_slice
#712
Merged
apoelstra
merged 2 commits into
rust-bitcoin:master
from
Kixunil:deprecate-message-from-digest-slice
Jul 28, 2024
Merged
Deprecate Message::from_digest_slice
#712
apoelstra
merged 2 commits into
rust-bitcoin:master
from
Kixunil:deprecate-message-from-digest-slice
Jul 28, 2024
+52
−51
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72b753f
to
c536871
Compare
Can be rebased now, #709 is in. |
c536871
to
ff5188d
Compare
The hex-lit thing requires you update the lockfiles. I'm not sure why CI isn't failing. |
The tests defined custom `hex!` macros (yes, two actually) that evaluated to `Vec<u8>`. While the performance didn't matter it made it harder to use with interfaces that require arrays and all current uses were passing it as slices anyway. So, in preparation for upcoming changes, this commit introduces `hex_lit` dev-dependency which evaluates to array allowing better interaction with type checker.
All sensible hash engines return arrays, not slices or other things, therefore `Message::from_digest_slice` is most likely entirely unneeded since the array version does a better job and in those rare cases where it is, the users can just call `.try_into()` themselves. This commit deprecates `from_digest_slice` and changes all tests to use `from_digest` except the test that tests `from_digest_slice`. It also simplifies its code to use `try_into` rather than convert manually and inefficiently.
ff5188d
to
939bf9e
Compare
Done. |
apoelstra
approved these changes
Jul 28, 2024
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 939bf9e
apoelstra
added a commit
that referenced
this pull request
Jul 29, 2024
72e09c1 Improve the comment on `Message::from_digest` (Martin Habovstiak) Pull request description: Minor improvement on top of #712 ACKs for top commit: apoelstra: ACK 72e09c1 Tree-SHA512: 06e8e706bb9732ea46ef3488ed33f7c7c84ea5afa5b1b2bca03cd2641524ff61156133436c1dd62df62769c8544644e1a4453fbacf4413fece73282ae154a387
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #710
On top of #709