Skip to content

Commit 173cc53

Browse files
committed
Rename LeafInfo into ScriptLeaf
1 parent e183997 commit 173cc53

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/util/psbt/map/output.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use util::psbt::map::Map;
2626
use util::psbt::raw;
2727
use util::psbt::Error;
2828

29-
use util::taproot::{LeafInfo, TapLeafHash};
29+
use util::taproot::{ScriptLeaf, TapLeafHash};
3030

3131
use util::taproot::{NodeInfo, TaprootBuilder};
3232

@@ -156,7 +156,7 @@ impl TapTree {
156156
}
157157

158158
/// Returns [`TapTreeIter`] iterator for a taproot script tree, operating in DFS order over
159-
/// leaf depth and leaf script pairs.
159+
/// tree [`ScriptLeaf`]s.
160160
pub fn script_leaves(&self) -> TapTreeIter {
161161
self.into_iter()
162162
}
@@ -165,11 +165,11 @@ impl TapTree {
165165
/// Iterator for a taproot script tree, operating in DFS order over leaf depth and
166166
/// leaf script pairs.
167167
pub struct TapTreeIter<'tree> {
168-
leaf_iter: core::slice::Iter<'tree, LeafInfo>,
168+
leaf_iter: core::slice::Iter<'tree, ScriptLeaf>,
169169
}
170170

171171
impl<'tree> Iterator for TapTreeIter<'tree> {
172-
type Item = &'tree LeafInfo;
172+
type Item = &'tree ScriptLeaf;
173173

174174
#[inline]
175175
fn next(&mut self) -> Option<Self::Item> {
@@ -178,7 +178,7 @@ impl<'tree> Iterator for TapTreeIter<'tree> {
178178
}
179179

180180
impl<'tree> IntoIterator for &'tree TapTree {
181-
type Item = &'tree LeafInfo;
181+
type Item = &'tree ScriptLeaf;
182182
type IntoIter = TapTreeIter<'tree>;
183183

184184
fn into_iter(self) -> Self::IntoIter {

src/util/taproot.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ pub struct NodeInfo {
560560
/// Merkle hash for this node.
561561
pub(crate) hash: sha256::Hash,
562562
/// Information about leaves inside this node.
563-
pub(crate) leaves: Vec<LeafInfo>,
563+
pub(crate) leaves: Vec<ScriptLeaf>,
564564
/// Tracks information on hidden nodes below this node.
565565
pub(crate) has_hidden_nodes: bool,
566566
}
@@ -577,7 +577,7 @@ impl NodeInfo {
577577

578578
/// Creates a new leaf [`NodeInfo`] with given [`Script`] and [`LeafVersion`].
579579
pub fn new_leaf_with_ver(script: Script, ver: LeafVersion) -> Self {
580-
let leaf = LeafInfo::new(script, ver);
580+
let leaf = ScriptLeaf::new(script, ver);
581581
Self {
582582
hash: sha256::Hash::from_inner(leaf.leaf_hash().into_inner()),
583583
leaves: vec![leaf],
@@ -608,7 +608,7 @@ impl NodeInfo {
608608
/// Store information about taproot leaf node.
609609
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
610610
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
611-
pub struct LeafInfo {
611+
pub struct ScriptLeaf {
612612
/// The underlying script.
613613
script: Script,
614614
/// The leaf version.
@@ -617,8 +617,8 @@ pub struct LeafInfo {
617617
merkle_branch: TaprootMerkleBranch,
618618
}
619619

620-
impl LeafInfo {
621-
/// Creates an new [`LeafInfo`] from `script` and `ver` and no merkle branch.
620+
impl ScriptLeaf {
621+
/// Creates an new [`ScriptLeaf`] from `script` and `ver` and no merkle branch.
622622
fn new(script: Script, ver: LeafVersion) -> Self {
623623
Self {
624624
script: script,
@@ -635,7 +635,7 @@ impl LeafInfo {
635635
self.merkle_branch.0.len() as u8
636636
}
637637

638-
/// Computes a leaf hash for this [`LeafInfo`].
638+
/// Computes a leaf hash for this [`ScriptLeaf`].
639639
#[inline]
640640
pub fn leaf_hash(&self) -> TapLeafHash {
641641
TapLeafHash::from_script(&self.script, self.ver)

0 commit comments

Comments
 (0)