Merged
Conversation
Add a new trait `TxIdentifier` that abstracts over the `Txid` and `Wtxid` types. We make `AsRef` a super trait so that the new trait needs no methods. Seal the trait so consumers of the library cannot implement it. Use the new trait in: - the `bip152` module to tighten up the `with_siphash_keys` function - as a trait bound on the `Leaf` associated type in the `MerkleNode` trait
3bd8032 to
a738754
Compare
apoelstra
approved these changes
Jul 9, 2024
Kixunil
reviewed
Jul 10, 2024
| match version { | ||
| 1 => short_ids.push(ShortId::with_siphash_keys(&tx.compute_txid(), siphash_keys)), | ||
| 2 => short_ids.push(ShortId::with_siphash_keys(&tx.compute_wtxid(), siphash_keys)), | ||
| _ => unreachable!(), |
Collaborator
There was a problem hiding this comment.
OT but this should be an enum. Honestly last time I looked at this module I didn't like it at all. IIUC it's a literal transaction from C++ Core code, so that's why it's not idiomatic.
Member
Author
There was a problem hiding this comment.
Yeah IMO all the bip modules need a bunch of love, I wasn't going to give it to them until after all the crate smashing is done.
Kixunil
approved these changes
Jul 10, 2024
This file contains hidden or 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
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.
Add a new trait
TxIdentifierthat abstracts over theTxidandWtxidtypes. We makeAsRefa super trait so that the new trait needs no methods.Seal the trait so consumers of the library cannot implement it.
Use the new trait in:
bip152module to tighten up thewith_siphash_keysfunctionLeafassociated type in theMerkleNodetrait