From 9ff0e068101df2a4eb6737ebf7ba048b2511ecb2 Mon Sep 17 00:00:00 2001 From: eunoia_1729 Date: Sat, 11 Jun 2022 15:36:59 +0530 Subject: [PATCH] Add getter methods for PartialMerkleTree fields --- src/util/merkleblock.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/util/merkleblock.rs b/src/util/merkleblock.rs index ddeb3d8f..5e3c3478 100644 --- a/src/util/merkleblock.rs +++ b/src/util/merkleblock.rs @@ -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 { + &self.bits + } + + /// Returns the transaction ids and internal hashes of the partial merkle tree. + pub fn hashes(&self) -> &Vec { + &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.