Skip to content

Commit 23a014d

Browse files
committed
Make TapTreeIterator use LeafInfo
Previously used depth and script tuple missed information about the leaf version. All three comprises already existing type `LeafInfo` which was made public in previous commits.
1 parent d6d65bc commit 23a014d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/util/psbt/map/output.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,16 @@ pub struct TapTreeIter<'tree> {
169169
}
170170

171171
impl<'tree> Iterator for TapTreeIter<'tree> {
172-
type Item = (u8, &'tree Script);
172+
type Item = &'tree LeafInfo;
173173

174+
#[inline]
174175
fn next(&mut self) -> Option<Self::Item> {
175-
self.leaf_iter.next().map(|leaf_info| {
176-
(leaf_info.merkle_branch.as_inner().len() as u8, &leaf_info.script)
177-
})
176+
self.leaf_iter.next()
178177
}
179178
}
180179

181180
impl<'tree> IntoIterator for &'tree TapTree {
182-
type Item = (u8, &'tree Script);
181+
type Item = &'tree LeafInfo;
183182
type IntoIter = TapTreeIter<'tree>;
184183

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

0 commit comments

Comments
 (0)