Skip to content

Commit

Permalink
update spent outputs in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Jan 10, 2024
1 parent 74e903d commit b80caaf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/bin/inx-chronicle/migrations/migrate_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use chronicle::{
tangle::LedgerUpdateStore,
};
use futures::prelude::stream::TryStreamExt;
use tokio::task::JoinSet;
use tokio::{task::JoinSet, try_join};

use super::Migration;

Expand Down Expand Up @@ -70,9 +70,16 @@ impl Migration for Migrate {
let db = db.clone();
let batch = batch.to_vec();
tasks.spawn(async move {
db.collection::<LedgerUpdateCollection>()
.insert_spent_ledger_updates(&batch)
.await
try_join! {
async {
db.collection::<OutputCollection>().update_spent_outputs(&batch).await?;
Ok(())
},
async {
db.collection::<LedgerUpdateCollection>().insert_spent_ledger_updates(&batch).await?;
Ok(())
}
}.and(Ok(()))
});
}

Expand Down

0 comments on commit b80caaf

Please sign in to comment.