Make LeafInfo::leaf_hash public and change its name and return type

This commit is contained in:
Dr Maxim Orlovsky 2022-03-31 14:59:34 +02:00
parent c83893d497
commit 5958466678
No known key found for this signature in database
GPG Key ID: FFC0250947E5C6F7
1 changed files with 4 additions and 4 deletions

View File

@ -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)
}
}