Skip to content

Commit 7d18457

Browse files
committed
Merge rust-bitcoin/rust-bitcoin#1051: Add getter methods for PartialMerkleTree fields
9ff0e06 Add getter methods for PartialMerkleTree fields (eunoia_1729) Pull request description: Resolves: #1046 ACKs for top commit: apoelstra: ACK 9ff0e06 tcharding: ACK 9ff0e06 Tree-SHA512: 849f2bf87ab99a8f975ee9c78eaaf3b8d392c3338317d94234ceb9da0d78bddd488c67dfb3ded1c572d5ce400c10263d75815315a4cd52b80cd6b60e12d55078
2 parents 5e7bfd0 + dc9f18c commit 7d18457

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/util/merkleblock.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,21 @@ pub struct PartialMerkleTree {
122122
}
123123

124124
impl PartialMerkleTree {
125+
/// Returns the total number of transactions in the block.
126+
pub fn num_transactions(&self) -> u32 {
127+
self.num_transactions
128+
}
129+
130+
/// Returns the node-is-parent-of-matched-txid bits of the partial merkle tree.
131+
pub fn bits(&self) -> &Vec<bool> {
132+
&self.bits
133+
}
134+
135+
/// Returns the transaction ids and internal hashes of the partial merkle tree.
136+
pub fn hashes(&self) -> &Vec<TxMerkleNode> {
137+
&self.hashes
138+
}
139+
125140
/// Construct a partial merkle tree
126141
/// The `txids` are the transaction hashes of the block and the `matches` is the contains flags
127142
/// wherever a tx hash should be included in the proof.

0 commit comments

Comments
 (0)