[bdk_chain_redesign] Fix calculation bugs.

* `IndexedTxGraph::try_balance` should include "confirmed and spendable"
  into `confirmed` balance.
* `TxGraph::try_list_chain_unspents` filter logic should be reversed.
This commit is contained in:
rajarshimaitra
2023-04-27 19:38:25 +05:30
committed by 志宇
parent e536307e5c
commit 911af34f50
2 changed files with 5 additions and 7 deletions

View File

@@ -860,7 +860,7 @@ impl<A: Anchor> TxGraph<A> {
chain_tip: BlockId,
) -> impl Iterator<Item = Result<FullTxOut<ObservedAs<A>>, C::Error>> + 'a {
self.try_list_chain_txouts(chain, chain_tip)
.filter(|r| !matches!(r, Ok(txo) if txo.spent_by.is_none()))
.filter(|r| matches!(r, Ok(txo) if txo.spent_by.is_none()))
}
/// List unspent outputs (UTXOs) that are in `chain` with `chain_tip`.