Add getter methods for PartialMerkleTree fields

This commit is contained in:
eunoia_1729 2022-06-11 15:36:59 +05:30
parent 09dd83add5
commit 9ff0e06810
No known key found for this signature in database
GPG Key ID: 9250C363C00A1E70
1 changed files with 15 additions and 0 deletions

View File

@ -122,6 +122,21 @@ pub struct PartialMerkleTree {
}
impl PartialMerkleTree {
/// Returns the total number of transactions in the block.
pub fn num_transactions(&self) -> u32 {
self.num_transactions
}
/// Returns the node-is-parent-of-matched-txid bits of the partial merkle tree.
pub fn bits(&self) -> &Vec<bool> {
&self.bits
}
/// Returns the transaction ids and internal hashes of the partial merkle tree.
pub fn hashes(&self) -> &Vec<TxMerkleNode> {
&self.hashes
}
/// Construct a partial merkle tree
/// The `txids` are the transaction hashes of the block and the `matches` is the contains flags
/// wherever a tx hash should be included in the proof.