Skip to content

Merkle root calculation and witness commitment check for Block#218

Merged
TheBlueMatt merged 1 commit intorust-bitcoin:masterfrom
tamasblummer:merkle_root_fix
Feb 17, 2019
Merged

Merkle root calculation and witness commitment check for Block#218
TheBlueMatt merged 1 commit intorust-bitcoin:masterfrom
tamasblummer:merkle_root_fix

Conversation

@tamasblummer
Copy link
Copy Markdown
Contributor

Merkle root calculation for a block should use txid() of transactions.
There was no specialized implementation of MerkleRoot for Block, but one for &[ ? :BitcoinHash] which matches the txdata vector in Block, thereby misleading to use it for merkle root calculation of blocks.

@tamasblummer tamasblummer changed the title Implement the correct merkle root calculation for Blocks Implement the correct merkle root calculation for Block Jan 20, 2019
@TheBlueMatt
Copy link
Copy Markdown
Member

TheBlueMatt commented Jan 20, 2019 via email

@tamasblummer
Copy link
Copy Markdown
Contributor Author

I think we should remove the [ ? :BitcoinHash] implementation. The wittness merkle root needs the BitcoinHash based calc. I plan to add a method to check witness commitment in coinbase, that would be explicit there.

@tamasblummer tamasblummer changed the title Implement the correct merkle root calculation for Block Merkle root calculation and witness commitment check for Block Jan 21, 2019
@tamasblummer tamasblummer force-pushed the merkle_root_fix branch 4 times, most recently from 4bc55d1 to fcca7eb Compare January 21, 2019 16:05
@tamasblummer
Copy link
Copy Markdown
Contributor Author

@TheBlueMatt how to deal with this fuzz error? I can't figure if it is related at all.

@TheBlueMatt
Copy link
Copy Markdown
Member

I kicked travis. I think it is random (and spurious), but @dongcarl would have to confirm.

@dongcarl
Copy link
Copy Markdown
Member

@tamasblummer If you're seeing what I think you're seeing... According to @sgeisler it is spurious and will go away once we merge #210 and bump serde. I would urge that we merge #210 soon.

@tamasblummer tamasblummer force-pushed the merkle_root_fix branch 3 times, most recently from 61b07cd to 98c951d Compare January 22, 2019 21:02
@tamasblummer
Copy link
Copy Markdown
Contributor Author

TheBlueMatt
TheBlueMatt previously approved these changes Jan 24, 2019
Copy link
Copy Markdown
Member

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

Looks good. Will likely need rather straijghtforward rebase after #215.

dongcarl
dongcarl previously approved these changes Feb 1, 2019
Copy link
Copy Markdown
Member

@dongcarl dongcarl left a comment

Choose a reason for hiding this comment

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

LGTM once squashed.

@tamasblummer
Copy link
Copy Markdown
Contributor Author

there are tests added in this PR what do you mean?

@dongcarl
Copy link
Copy Markdown
Member

dongcarl commented Feb 1, 2019

there are tests added in this PR what do you mean?

You're right. My apologies!

…mentations for types implementing BitcoinHash as

it is misleading. MerkleRoot is defined instead for a Block.
@tamasblummer
Copy link
Copy Markdown
Contributor Author

squashed

Copy link
Copy Markdown
Member

@dongcarl dongcarl left a comment

Choose a reason for hiding this comment

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

ACK d8c93d9

@dongcarl
Copy link
Copy Markdown
Member

dongcarl commented Feb 1, 2019

@TheBlueMatt Please re-ACK

@TheBlueMatt TheBlueMatt merged commit 084703c into rust-bitcoin:master Feb 17, 2019
yancyribbens pushed a commit to yancyribbens/rust-bitcoin that referenced this pull request Mar 23, 2024
Add secp as a param instead of creating a new context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants