From d655ff3e9307692318d5c8f248e4a2681ba2ef14 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Wed, 30 Mar 2022 12:49:57 +0200 Subject: [PATCH] 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. --- src/util/psbt/map/output.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/util/psbt/map/output.rs b/src/util/psbt/map/output.rs index c49eb760..0dd6df22 100644 --- a/src/util/psbt/map/output.rs +++ b/src/util/psbt/map/output.rs @@ -169,17 +169,16 @@ pub struct TapTreeIter<'tree> { } impl<'tree> Iterator for TapTreeIter<'tree> { - type Item = (u8, &'tree Script); + type Item = &'tree LeafInfo; + #[inline] fn next(&mut self) -> Option { - self.leaf_iter.next().map(|leaf_info| { - (leaf_info.merkle_branch.as_inner().len() as u8, &leaf_info.script) - }) + self.leaf_iter.next() } } impl<'tree> IntoIterator for &'tree TapTree { - type Item = (u8, &'tree Script); + type Item = &'tree LeafInfo; type IntoIter = TapTreeIter<'tree>; fn into_iter(self) -> Self::IntoIter {