Skip to content

Commit d6d65bc

Browse files
committed
LeafInfo field accessor methods
1 parent 274c90e commit d6d65bc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/util/taproot.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,25 @@ impl LeafInfo {
632632
pub fn leaf_hash(&self) -> TapLeafHash {
633633
TapLeafHash::from_script(&self.script, self.ver)
634634
}
635+
636+
/// Returns reference to the leaf script.
637+
#[inline]
638+
pub fn script(&self) -> &Script {
639+
&self.script
640+
}
641+
642+
/// Returns leaf version of the script.
643+
#[inline]
644+
pub fn leaf_version(&self) -> LeafVersion {
645+
self.ver
646+
}
647+
648+
/// Returns reference to the merkle proof (hashing partners) to get this
649+
/// node in form of [`TaprootMerkleBranch`].
650+
#[inline]
651+
pub fn merkle_branch(&self) -> &TaprootMerkleBranch {
652+
&self.merkle_branch
653+
}
635654
}
636655

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

0 commit comments

Comments
 (0)