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.
This commit is contained in:
parent
79345fcd02
commit
d655ff3e93
|
@ -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::Item> {
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue