From 79345fcd023e5928094943cb89855c39833a38ef Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Mar 2022 15:01:48 +0200 Subject: [PATCH] LeafInfo field accessor methods --- src/util/taproot.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index ca680210..efc42576 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -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.