Skip to content

Commit 12c49bf

Browse files
TO BE SQUASHED: cargo fmt on the previous commit
1 parent 82b9af4 commit 12c49bf

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

crates/chain/src/tx_graph.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,25 +1073,37 @@ impl<A> ChangeSet<A> {
10731073
/// confirm or exclude these anchors.
10741074
///
10751075
/// See also: [`Self::missing_heights`]
1076-
pub fn relevant_heights(&self) -> impl Iterator<Item=u32> + '_ where A: Anchor {
1076+
pub fn relevant_heights(&self) -> impl Iterator<Item = u32> + '_
1077+
where
1078+
A: Anchor,
1079+
{
10771080
let mut dedup = None;
1078-
self.anchors.iter().map(|(a, _)| a.anchor_block().height).filter(move |height| {
1079-
let duplicate = dedup == Some(*height);
1080-
dedup = Some(*height);
1081-
!duplicate
1082-
})
1081+
self.anchors
1082+
.iter()
1083+
.map(|(a, _)| a.anchor_block().height)
1084+
.filter(move |height| {
1085+
let duplicate = dedup == Some(*height);
1086+
dedup = Some(*height);
1087+
!duplicate
1088+
})
10831089
}
10841090

1085-
10861091
/// Returns an iterator for the [`relevant_heights`] in this changeset that are not included in
10871092
/// `local_chain`. This tells you which heights you need to include in `local_chain` in order
10881093
/// for it to conclusively act as a [`ChainOracle`] for the transaction anchors this changeset
10891094
/// will add.
10901095
///
10911096
/// [`ChainOracle`]: crate::ChainOracle
10921097
/// [`relevant_heights`]: Self::relevant_heights
1093-
pub fn missing_heights_from<'a>(&'a self, local_chain: &'a LocalChain) -> impl Iterator<Item=u32> + 'a where A: Anchor {
1094-
self.relevant_heights().filter(move |height| !local_chain.blocks().contains_key(height))
1098+
pub fn missing_heights_from<'a>(
1099+
&'a self,
1100+
local_chain: &'a LocalChain,
1101+
) -> impl Iterator<Item = u32> + 'a
1102+
where
1103+
A: Anchor,
1104+
{
1105+
self.relevant_heights()
1106+
.filter(move |height| !local_chain.blocks().contains_key(height))
10951107
}
10961108
}
10971109

0 commit comments

Comments
 (0)