Skip to content

Commit

Permalink
Improve test_accept_not_a_better_block wait chain_service finished be…
Browse files Browse the repository at this point in the history
…fore exit
  • Loading branch information
eval-exec committed Aug 2, 2024
1 parent b31c07d commit 9a96db5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sync/src/relayer/tests/compact_block_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ fn test_accept_not_a_better_block() {
peer_index,
);
assert_eq!(compact_block_process.execute(), Status::ok());

// wait chain_service processed the compact block, check block hash in snapshot
{
let now = std::time::Instant::now();
loop {
std::thread::sleep(std::time::Duration::from_millis(100));
if now.elapsed().as_secs() > 5 {
panic!("wait chain_service processed the compact block timeout");
}
let snapshot = relayer.shared.shared().snapshot();
if snapshot.get_block(&uncle_block.header().hash()).is_some() {
break;
}
}
}
}

#[test]
Expand Down

0 comments on commit 9a96db5

Please sign in to comment.