8000 Add a MerkleBlock construction by erasmospunk · Pull Request #268 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add a MerkleBlock construction #268

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

Merged
merged 2 commits into from
Jul 10, 2019

Conversation

erasmospunk
Copy link
Contributor

This is a port of the bitcoin-core CPartialMerkleTree and CMerkleBlock classes.
Here they are called PartialMerkleTree and MerkleBlock.

These are useful for SPV clients that wish to verify that a transaction is
present in a specific block in an authenticated way.

This is a better attempt than my previous PR #19.

Note regarding the doc examples, I used ignore attribute to avoid failures with the older 1.22.0 Rust on TravisCI. It could be related to the usage of extern crate ... in the examples. The doc tests pass as of Rust 1.32.0.

@apoelstra
Copy link
Member

Please rebase, and please also write doctests that are compatible with 1.22 instead of ignoring them if possible.

@erasmospunk
Copy link
Contributor Author

@apoelstra rebased & pushed with a hack/fix for the failing doctests on Rust 1.22.

@apoelstra
Copy link
Member

I'm curious why you use the extra hex crate rather than just using bitcoin_hashes hex decoding, which you do import.

apoelstra
apoelstra previously approved these changes Jul 5, 2019
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.

utACK. This looks great, thanks!

@erasmospunk
Copy link
Contributor Author

I'm curious why you use the extra hex crate rather than just using bitcoin_hashes hex decoding, which you do import.

Just copy pasted it from the tests but using the FromHex trait looks better as an example.

Also I will change the examples a bit because the extern crate and use are not visible in the generated HTML.

This is a port of the bitcoin-core CPartialMerkleTree and CMerkleBlock classes.
Here they are called PartialMerkleTree and MerkleBlock.

These are useful for SPV clients that wish to verify that a transaction is
present in a specific block in an authenticated way.
@erasmospunk
Copy link
Contributor Author

Fixed the last issues withe the doctests.

@apoelstra apoelstra merged commit 7839484 into rust-bitcoin:master Jul 10, 2019
yancyribbens pushed a commit to yancyribbens/rust-bitcoin that referenced this pull request Mar 23, 2024
cf05787 Remove fixed TODO (sanket1729)

Pull request description:

  This TODO was actually from 255 where the bug was in cast_unlikely, even though the issue is labeled with or_i (my bad for not checking). There is no code for `cast_unlikely` as it is treated as or_i.

  Addressed in 239efd5

  Fixes rust-bitcoin#268

ACKs for top commit:
  apoelstra:
    ACK cf05787

Tree-SHA512: c55236979dfaac3e104edd35eb191be20fe45b6e994a886603d9b9c5559f49723fdaa10f73eaee7e7d6f30170f948f609e0369cd65c3569585675d432661f74a
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
0