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> {
|
impl<'tree> Iterator for TapTreeIter<'tree> {
|
||||||
type Item = (u8, &'tree Script);
|
type Item = &'tree LeafInfo;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.leaf_iter.next().map(|leaf_info| {
|
self.leaf_iter.next()
|
||||||
(leaf_info.merkle_branch.as_inner().len() as u8, &leaf_info.script)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tree> IntoIterator for &'tree TapTree {
|
impl<'tree> IntoIterator for &'tree TapTree {
|
||||||
type Item = (u8, &'tree Script);
|
type Item = &'tree LeafInfo;
|
||||||
type IntoIter = TapTreeIter<'tree>;
|
type IntoIter = TapTreeIter<'tree>;
|
||||||
|
|
||||||
fn into_iter(self) -> Self::IntoIter {
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
|
|
Loading…
Reference in New Issue