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 a MerkleBlock construction #268

Merged
merged 2 commits into from Jul 10, 2019

Conversation

Projects
None yet
3 participants
@erasmospunk
Copy link
Contributor

commented May 27, 2019

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.

Show resolved Hide resolved src/util/merkleblock.rs Outdated
Show resolved Hide resolved src/util/merkleblock.rs Outdated
Show resolved Hide resolved src/util/merkleblock.rs Outdated

@erasmospunk erasmospunk force-pushed the erasmospunk:merkleblock branch 2 times, most recently from d723741 to 6b59e56 May 28, 2019

@erasmospunk erasmospunk force-pushed the erasmospunk:merkleblock branch from 6b59e56 to 191c488 Jun 16, 2019

@erasmospunk erasmospunk force-pushed the erasmospunk:merkleblock branch from 191c488 to 7273291 Jun 27, 2019

@apoelstra

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

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

@erasmospunk erasmospunk force-pushed the erasmospunk:merkleblock branch from 7273291 to 6391610 Jul 5, 2019

@erasmospunk erasmospunk force-pushed the erasmospunk:merkleblock branch from 6391610 to 6417a40 Jul 5, 2019

@erasmospunk

This comment has been minimized.

Copy link
Contributor Author

commented Jul 5, 2019

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

@apoelstra

This comment has been minimized.

Copy link
Member

commented Jul 5, 2019

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

@apoelstra
Copy link
Member

left a comment

utACK. This looks great, thanks!

@erasmospunk

This comment has been minimized.

Copy link
Contributor Author

commented Jul 5, 2019

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.

Add a MerkleBlock construction
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 erasmospunk force-pushed the erasmospunk:merkleblock branch from 6417a40 to aae2937 Jul 5, 2019

@erasmospunk

This comment has been minimized.

Copy link
Contributor Author

commented Jul 5, 2019

Fixed the last issues withe the doctests.

@apoelstra apoelstra merged commit 7839484 into rust-bitcoin:master Jul 10, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.