Skip to content

Commit

Permalink
Make LeafInfo::leaf_hash public and change its name and return type
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Apr 19, 2022
1 parent c83893d commit 5958466
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 5958466

Please sign in to comment.