Skip to content

Commit c753584

Browse files
committed
refactor(chain): use apply_update instead of determine_changeset + apply_changeset
1 parent fa0bead commit c753584

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

crates/chain/src/tx_graph.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,7 @@ impl<A: Clone + Ord> TxGraph<A> {
385385
0,
386386
),
387387
);
388-
let changeset = self.determine_changeset(update);
389-
self.apply_changeset(changeset.clone());
390-
changeset
388+
self.apply_update(update)
391389
}
392390

393391
/// Inserts the given transaction into [`TxGraph`].
@@ -398,9 +396,7 @@ impl<A: Clone + Ord> TxGraph<A> {
398396
update
399397
.txs
400398
.insert(tx.txid(), (TxNodeInternal::Whole(tx), BTreeSet::new(), 0));
401-
let changeset = self.determine_changeset(update);
402-
self.apply_changeset(changeset.clone());
403-
changeset
399+
self.apply_update(update)
404400
}
405401

406402
/// Inserts the given `anchor` into [`TxGraph`].
@@ -410,9 +406,7 @@ impl<A: Clone + Ord> TxGraph<A> {
410406
pub fn insert_anchor(&mut self, txid: Txid, anchor: A) -> ChangeSet<A> {
411407
let mut update = Self::default();
412408
update.anchors.insert((anchor, txid));
413-
let changeset = self.determine_changeset(update);
414-
self.apply_changeset(changeset.clone());
415-
changeset
409+
self.apply_update(update)
416410
}
417411

418412
/// Inserts the given `seen_at` for `txid` into [`TxGraph`].
@@ -422,9 +416,7 @@ impl<A: Clone + Ord> TxGraph<A> {
422416
let mut update = Self::default();
423417
let (_, _, update_last_seen) = update.txs.entry(txid).or_default();
424418
*update_last_seen = seen_at;
425-
let changeset = self.determine_changeset(update);
426-
self.apply_changeset(changeset.clone());
427-
changeset
419+
self.apply_update(update)
428420
}
429421

430422
/// Extends this graph with another so that `self` becomes the union of the two sets of

0 commit comments

Comments
 (0)