Skip to content

Commit

Permalink
[reconfig] Remove all pending transactions at epoch boundary (MystenL…
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Jun 27, 2022
1 parent da6f8be commit 467accc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions crates/sui-core/src/authority/authority_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,20 @@ impl<const ALL_OBJ_VER: bool, S: Eq + Serialize + for<'de> Deserialize<'de>>
Ok(())
}

// Empty the pending_execution table, and remove the certs from the certificates table.
pub fn remove_all_pending_certificates(&self) -> SuiResult {
let all_pending_tx = self.get_pending_certificates()?;
let mut batch = self.pending_execution.batch();
batch = batch.delete_batch(
&self.certificates,
all_pending_tx.iter().map(|(_, digest)| digest),
)?;
batch.write()?;
self.pending_execution.clear()?;

Ok(())
}

/// A function that acquires all locks associated with the objects (in order to avoid deadlocks).
async fn acquire_locks<'a, 'b>(&'a self, input_objects: &'b [ObjectRef]) -> Vec<LockGuard<'a>> {
self.mutex_table
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-core/src/epoch/reconfiguration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
// Delete any extra certificates now unprocessed.
checkpoints.extra_transactions.clear()?;

// TODO(issue #2708): Delete certificates from the pending store.
self.state.database.remove_all_pending_certificates()?;

// drop checkpoints lock
} else {
Expand Down

0 comments on commit 467accc

Please sign in to comment.