impl<A> ChangeSet<A> {
/// Returns true if the [`ChangeSet`] is empty (no transactions or txouts).
pub fn is_empty(&self) -> bool {
- self.txs.is_empty() && self.txouts.is_empty()
+ self.txs.is_empty()
+ && self.txouts.is_empty()
+ && self.anchors.is_empty()
+ && self.last_seen.is_empty()
}
/// Iterates over all outpoints contained within [`ChangeSet`].
};
let mut graph = TxGraph::<()>::default();
- let _ = graph.insert_tx(tx);
+ let changeset = graph.insert_tx(tx);
+ assert!(!changeset.is_empty());
assert!(graph.outspends(OutPoint::null()).is_empty());
assert!(graph.tx_spends(Txid::all_zeros()).next().is_none());
}
}],
};
- let _ = tx_graph.insert_txout(
+ let changeset = tx_graph.insert_txout(
OutPoint {
txid: tx.txid(),
vout: 0,
},
);
+ assert!(!changeset.is_empty());
+
let _ = tx_graph.insert_txout(
OutPoint {
txid: tx.txid(),
]);
[&tx_a0, &tx_b1].iter().for_each(|&tx| {
- let _ = graph.insert_anchor(tx.txid(), tip.block_id());
+ let changeset = graph.insert_anchor(tx.txid(), tip.block_id());
+ assert!(!changeset.is_empty());
});
let ancestors = [
last_seen: original_ls.map(|ls| (txid, ls)).into_iter().collect(),
..Default::default()
};
+ assert!(!original.is_empty() || original_ls.is_none());
let update = ChangeSet::<()> {
last_seen: update_ls.map(|ls| (txid, ls)).into_iter().collect(),
..Default::default()
};
+ assert!(!update.is_empty() || update_ls.is_none());
original.append(update);
assert_eq!(