diff --git a/crates/chain/src/tx_graph.rs b/crates/chain/src/tx_graph.rs index a0efa47aab..47884fab66 100644 --- a/crates/chain/src/tx_graph.rs +++ b/crates/chain/src/tx_graph.rs @@ -1073,16 +1073,21 @@ impl ChangeSet { /// confirm or exclude these anchors. /// /// See also: [`Self::missing_heights`] - pub fn relevant_heights(&self) -> impl Iterator + '_ where A: Anchor { + pub fn relevant_heights(&self) -> impl Iterator + '_ + where + A: Anchor, + { let mut dedup = None; - self.anchors.iter().map(|(a, _)| a.anchor_block().height).filter(move |height| { - let duplicate = dedup == Some(*height); - dedup = Some(*height); - !duplicate - }) + self.anchors + .iter() + .map(|(a, _)| a.anchor_block().height) + .filter(move |height| { + let duplicate = dedup == Some(*height); + dedup = Some(*height); + !duplicate + }) } - /// Returns an iterator for the [`relevant_heights`] in this changeset that are not included in /// `local_chain`. This tells you which heights you need to include in `local_chain` in order /// for it to conclusively act as a [`ChainOracle`] for the transaction anchors this changeset @@ -1090,8 +1095,15 @@ impl ChangeSet { /// /// [`ChainOracle`]: crate::ChainOracle /// [`relevant_heights`]: Self::relevant_heights - pub fn missing_heights_from<'a>(&'a self, local_chain: &'a LocalChain) -> impl Iterator + 'a where A: Anchor { - self.relevant_heights().filter(move |height| !local_chain.blocks().contains_key(height)) + pub fn missing_heights_from<'a>( + &'a self, + local_chain: &'a LocalChain, + ) -> impl Iterator + 'a + where + A: Anchor, + { + self.relevant_heights() + .filter(move |height| !local_chain.blocks().contains_key(height)) } }