Skip to content

Commit 5faa841

Browse files
committed
More explicit sync testing
1 parent 2f10658 commit 5faa841

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

tests/bitcoin.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ impl TestCase for BasicSyncTest {
3030
};
3131
let initial_height = f.initial_da_height;
3232

33+
f.bitcoin_nodes.wait_for_sync(None).await?;
34+
let height0 = da0.get_block_count().await?;
35+
let height1 = da1.get_block_count().await?;
36+
37+
// Assert that nodes are in sync before disconnection
38+
assert_eq!(height0, height1, "Block heights don't match");
39+
40+
f.bitcoin_nodes.disconnect_nodes().await?;
41+
3342
// Generate some blocks on node0
3443
da0.generate(5, None).await?;
3544

@@ -38,17 +47,16 @@ impl TestCase for BasicSyncTest {
3847

3948
// Nodes are now out of sync
4049
assert_eq!(height0, initial_height + 5);
41-
assert_eq!(height1, 0);
50+
assert_eq!(height1, initial_height);
4251

43-
// Sync both nodes
44-
f.bitcoin_nodes
45-
.wait_for_sync(Some(Duration::from_secs(30)))
46-
.await?;
52+
// Reconnect nodes and sync
53+
f.bitcoin_nodes.connect_nodes().await?;
54+
f.bitcoin_nodes.wait_for_sync(None).await?;
4755

4856
let height0 = da0.get_block_count().await?;
4957
let height1 = da1.get_block_count().await?;
5058

51-
// Assert that nodes are in sync
59+
// Assert that nodes are back in sync
5260
assert_eq!(height0, height1, "Block heights don't match");
5361

5462
Ok(())

0 commit comments

Comments
 (0)