Model merkle_root as TxMerkleNode#519
Merged
tcharding merged 1 commit intorust-bitcoin:masterfrom Feb 27, 2026
Merged
Conversation
tcharding
reviewed
Feb 26, 2026
types/src/v29/blockchain/into.rs
Outdated
| self.stripped_size.map(|size| crate::to_u32(size, "stripped_size")).transpose()?; | ||
| let weight = Weight::from_wu(self.weight); | ||
| let version = block::Version::from_consensus(self.version); | ||
| let merkle_root = self.merkle_root.parse::<TxMerkleNode>().map_err(E::Hash)?; |
Member
There was a problem hiding this comment.
This change is not 100% correct. It made me look if we do this elsewhere and we do. Created: #521
Collaborator
Author
There was a problem hiding this comment.
Added the error variant for merkle_root. Will have a look at the rest in a separate PR.
Some of the modelled types used a String for merkle_root. But it has a rust-bitcoin type TxMerkleNode. Change them all to TxMerkleNode, add the required error variant, and update the into_model() functions.
81b5686 to
162a2df
Compare
tcharding
approved these changes
Feb 27, 2026
tcharding
reviewed
Feb 27, 2026
| weight, | ||
| height: crate::to_u32(self.height, "height")?, | ||
| version, | ||
| merkle_root: self.merkle_root, // TODO: Use hash, which one depends on segwit or not. |
Member
There was a problem hiding this comment.
FTR I don't know what this comment is meaning referring to segwit? Perhaps I was confused when I wrote it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some of the modelled types used a
Stringformerkle_root. But it has a rust-bitcoin typeTxMerkleNode.Change them all to
TxMerkleNode, and update theinto_model()functions.