Skip to content

Commit fb75aa9

Browse files
committed
Clarify TxGraph::try_filter_chain_unspents logic
1 parent 96b1075 commit fb75aa9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/chain/src/tx_graph.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,12 @@ impl<A: Anchor> TxGraph<A> {
865865
outpoints: impl IntoIterator<Item = (S, OutPoint)> + 'a,
866866
) -> impl Iterator<Item = Result<(S, FullTxOut<ObservedAs<A>>), C::Error>> + 'a {
867867
self.try_filter_chain_txouts(chain, chain_tip, outpoints)
868-
.filter(|r| !matches!(r, Ok((_, full_txo)) if full_txo.spent_by.is_some()))
868+
.filter(|r| match r {
869+
// keep unspents, drop spents
870+
Ok((_, full_txo)) => full_txo.spent_by.is_none(),
871+
// keep errors
872+
Err(_) => true,
873+
})
869874
}
870875

871876
/// Get a filtered list of unspent outputs (UTXOs) from the given `outpoints` that are in

0 commit comments

Comments
 (0)