Skip to content

Commit

Permalink
Use atomic db operations in verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrembal committed Sep 5, 2024
1 parent 575dca5 commit 789b508
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ where
return Err(BridgeError::InvalidKickoffUtxo); // TODO: Better error
}

self.db
.save_agg_nonces(deposit_outpoint, &agg_nonces)
.await?;

let mut slash_or_take_sighashes: Vec<[u8; 32]> = Vec::new();

for (i, kickoff_utxo) in kickoff_utxos.iter().enumerate() {
Expand Down Expand Up @@ -213,6 +209,11 @@ where
slash_or_take_sighashes
);

let db_tx = self.db.begin_transaction().await?;

self.db
.save_agg_nonces(deposit_outpoint, &agg_nonces)
.await?;
let nonces = self
.db
.save_sighashes_and_get_nonces(
Expand Down Expand Up @@ -242,9 +243,7 @@ where
.save_kickoff_utxos(deposit_outpoint, &kickoff_utxos)
.await?;

// self.db
// .save_kickoff_root(deposit_outpoint, root_bytes)
// .await?;
db_tx.commit().await?;

// TODO: Sign burn txs
Ok((slash_or_take_partial_sigs, vec![]))
Expand Down

0 comments on commit 789b508

Please sign in to comment.