From 59584666783f7384fcd27ba4c4940714cc250faa Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 31 Mar 2022 14:59:34 +0200 Subject: [PATCH] Make LeafInfo::leaf_hash public and change its name and return type --- src/util/taproot.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 8715f294..ca680210 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -579,7 +579,7 @@ impl NodeInfo { pub fn new_leaf_with_ver(script: Script, ver: LeafVersion) -> Self { let leaf = LeafInfo::new(script, ver); Self { - hash: leaf.hash(), + hash: sha256::Hash::from_inner(leaf.leaf_hash().into_inner()), leaves: vec![leaf], has_hidden_nodes: false, } @@ -628,9 +628,9 @@ impl LeafInfo { } /// Computes a leaf hash for this [`LeafInfo`]. - fn hash(&self) -> sha256::Hash { - let leaf_hash = TapLeafHash::from_script(&self.script, self.ver); - sha256::Hash::from_inner(leaf_hash.into_inner()) + #[inline] + pub fn leaf_hash(&self) -> TapLeafHash { + TapLeafHash::from_script(&self.script, self.ver) } }