Skip to content

Commit

Permalink
LeafInfo field accessor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Apr 19, 2022
1 parent 5958466 commit 79345fc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/util/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,25 @@ impl LeafInfo {
pub fn leaf_hash(&self) -> TapLeafHash {
TapLeafHash::from_script(&self.script, self.ver)
}

/// Returns reference to the leaf script.
#[inline]
pub fn script(&self) -> &Script {
&self.script
}

/// Returns leaf version of the script.
#[inline]
pub fn leaf_version(&self) -> LeafVersion {
self.ver
}

/// Returns reference to the merkle proof (hashing partners) to get this
/// node in form of [`TaprootMerkleBranch`].
#[inline]
pub fn merkle_branch(&self) -> &TaprootMerkleBranch {
&self.merkle_branch
}
}

/// The merkle proof for inclusion of a tree in a taptree hash.
Expand Down

0 comments on commit 79345fc

Please sign in to comment.