Merge rust-bitcoin/rust-bitcoin#1051: Add getter methods for PartialMerkleTree fields
9ff0e06810
Add getter methods for PartialMerkleTree fields (eunoia_1729) Pull request description: Resolves: #1046 ACKs for top commit: apoelstra: ACK9ff0e06810
tcharding: ACK9ff0e06810
Tree-SHA512: 849f2bf87ab99a8f975ee9c78eaaf3b8d392c3338317d94234ceb9da0d78bddd488c67dfb3ded1c572d5ce400c10263d75815315a4cd52b80cd6b60e12d55078
This commit is contained in:
commit
f30df076d0
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue