Skip to content

Add unit test for bitcoin_merkle_root functions#711

Merged
RCasatta merged 1 commit intorust-bitcoin:masterfrom
tcharding:test-merkle-root
Nov 22, 2021
Merged

Add unit test for bitcoin_merkle_root functions#711
RCasatta merged 1 commit intorust-bitcoin:masterfrom
tcharding:test-merkle-root

Conversation

@tcharding
Copy link
Copy Markdown
Member

We test bitcoin_merkle_root over in the blockdata::block module.
Although the bitcoin_merkle_root and bitcoin_merkle_root_inline
functions are almost identical there is enough index manipulation done
that it is not immediately obvious that the code is error free.

Add a unit test that verifies that the two functions return the same
resulting merkle root.

This was done in response to #394.

Copy link
Copy Markdown
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.

Please fix the CI failure.

Also while useful, I think it'd be even better to somehow unify the two functions so same logic would always be guaranteed.

@Kixunil Kixunil added code quality Makes code easier to understand and less likely to lead to problems Tests labels Nov 19, 2021
We test `bitcoin_merkle_root` over in the `blockdata::block` module.
Although the `bitcoin_merkle_root` and `bitcoin_merkle_root_inline`
functions are almost identical there is enough index manipulation done
that it is not immediately obvious that the code is error free.

Add a unit test that verifies that the two functions return the same
resulting merkle root.
Copy link
Copy Markdown
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 e047950

@RCasatta
Copy link
Copy Markdown
Collaborator

ACK e047950

@RCasatta RCasatta merged commit 615a900 into rust-bitcoin:master Nov 22, 2021
@tcharding tcharding deleted the test-merkle-root branch November 25, 2021 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Makes code easier to understand and less likely to lead to problems Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants