LeafInfo field accessor methods

This commit is contained in:
Dr Maxim Orlovsky 2022-03-31 15:01:48 +02:00
parent 5958466678
commit 79345fcd02
No known key found for this signature in database
GPG Key ID: FFC0250947E5C6F7
1 changed files with 19 additions and 0 deletions

View File

@ -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.