feat(chain): Add initial_changeset to graphs

Add `initial_changeset` to TxGraph and IndexedTxGraph
This commit is contained in:
Daniela Brozzoni
2023-08-16 17:39:35 +02:00
parent ea50b6a932
commit 80f5ecf3be
8 changed files with 49 additions and 9 deletions

View File

@@ -438,6 +438,11 @@ impl<A: Clone + Ord> TxGraph<A> {
changeset
}
/// Determines the [`ChangeSet`] between `self` and an empty [`TxGraph`].
pub fn initial_changeset(&self) -> ChangeSet<A> {
Self::default().determine_changeset(self.clone())
}
/// Applies [`ChangeSet`] to [`TxGraph`].
pub fn apply_changeset(&mut self, changeset: ChangeSet<A>) {
for tx in changeset.txs {