Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix issue MystenLabs#1096
  • Loading branch information
asonnino authored Mar 30, 2022
1 parent feab273 commit 6a5dc05
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions sui_core/src/unit_tests/consensus_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,11 @@ async fn handle_consensus_output() {
.await
.unwrap();

// Wait for the certificate to be processed and ensure the last consensus index
// has been updated.
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
assert_eq!(
state.db().last_consensus_index().unwrap(),
SequenceNumber::from(1)
);
// Wait for the certificate to be processed and ensure the last consensus index is correctly updated.
// (We need to wait on storage for that.)
while state.db().last_consensus_index().unwrap() != SequenceNumber::from(1) {
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
}

// Cleanup the storage.
let _ = std::fs::remove_dir_all(store_path);
Expand Down Expand Up @@ -229,14 +227,11 @@ async fn sync_with_consensus() {
.await
.unwrap();

// Wait for the certificate to be processed.
tokio::time::sleep(std::time::Duration::from_millis(100)).await;

// Ensure the last consensus index is correctly updated.
assert_eq!(
state.db().last_consensus_index().unwrap(),
SequenceNumber::from(2)
);
// Wait for the certificate to be processed and ensure the last consensus index is correctly updated.
// (We need to wait on storage for that.)
while state.db().last_consensus_index().unwrap() != SequenceNumber::from(2) {
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
}

// Ensure the version number of the shared object is correctly updated.
let shared_object_id = test_shared_object().id();
Expand Down

0 comments on commit 6a5dc05

Please sign in to comment.