Skip to content

Commit dc9f18c

Browse files
committed
Add getter methods for PartialMerkleTree fields
1 parent d3c1042 commit dc9f18c

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)