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:
Dr Maxim Orlovsky 2022-03-30 12:49:57 +02:00
parent 79345fcd02
commit d655ff3e93
No known key found for this signature in database
GPG Key ID: FFC0250947E5C6F7
1 changed files with 4 additions and 5 deletions

View File

@ -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 {