Merkle root calculation and witness commitment check for Block#218
Merkle root calculation and witness commitment check for Block#218TheBlueMatt merged 1 commit intorust-bitcoin:masterfrom
Conversation
|
Sounds like we should also remove it for things that implement BitcoinHash and maybe implement for [Transaction], too?
… On Jan 20, 2019, at 12:07, Tamás Blummer ***@***.***> wrote:
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.
You can view, comment on, or merge this pull request online at:
#218
Commit Summary
Implement the correct merkle root calculation for Blocks
File Changes
M src/util/hash.rs (21)
Patch Links:
https://github.com/rust-bitcoin/rust-bitcoin/pull/218.patch
https://github.com/rust-bitcoin/rust-bitcoin/pull/218.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
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. |
2f13444 to
026ea2a
Compare
4bc55d1 to
fcca7eb
Compare
|
@TheBlueMatt how to deal with this fuzz error? I can't figure if it is related at all. |
|
I kicked travis. I think it is random (and spurious), but @dongcarl would have to confirm. |
|
@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 |
61b07cd to
98c951d
Compare
|
made checks of data sizes stricter matching https://github.com/bitcoin/bitcoin/pull/8149/files#diff-7ec3c68a81efff79b6ca22ac1f1eabbaR3637 |
TheBlueMatt
left a comment
There was a problem hiding this comment.
Looks good. Will likely need rather straijghtforward rebase after #215.
98c951d to
c7bebd0
Compare
|
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.
de1bda7 to
d8c93d9
Compare
|
squashed |
|
@TheBlueMatt Please re-ACK |
Add secp as a param instead of creating a new context
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.