Skip to content
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

add conversions from TXIDs to merkle nodes #2227

Merged
merged 1 commit into from Nov 27, 2023

Conversation

conduition
Copy link
Contributor

Fixes #2220.

Also adds the equivalent conversion trait from Wtxid -> WitnessMerkleNode.

Copy link
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 32eb461


impl From<Wtxid> for WitnessMerkleNode {
fn from(wtxid: Wtxid) -> Self {
Self::from(wtxid.0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

So this is not strictly wrong but since I think we should remove From<sha256d::Hash> this would then need to become Self(wtxid.0) (same above). Feel free to change but can go in either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it doesn't hurt to keep From<sha256d::Hash> for *MerkleNode; after all that's what merkle nodes fundamentally are (hashes)

Copy link
Member

Choose a reason for hiding this comment

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

@condution true, but the viewpoint we're moving toward is that MerkleNodes are a different kind of hash than sha256d::Hashes, even though they're computed with the same algorithm.

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 32eb461

@apoelstra apoelstra merged commit 64bd34c into rust-bitcoin:master Nov 27, 2023
29 checks passed
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.

From<Txid> for TxMerkleNode should exist
3 participants