Skip to content

Commit 151e0e2

Browse files
committed
Wait for both miners to advance before continuing test
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent c4ef003 commit 151e0e2

File tree

1 file changed

+15
-1
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+15
-1
lines changed

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,18 @@ fn miner_forking() {
19231923
.unwrap()
19241924
.block_height
19251925
};
1926+
1927+
let wait_for_chains = || {
1928+
wait_for(30, || {
1929+
let Some(chain_info_1) = get_chain_info_opt(&conf) else {
1930+
return Ok(false);
1931+
};
1932+
let Some(chain_info_2) = get_chain_info_opt(&conf_node_2) else {
1933+
return Ok(false);
1934+
};
1935+
Ok(chain_info_1.burn_block_height == chain_info_2.burn_block_height)
1936+
})
1937+
};
19261938
info!("------------------------- Reached Epoch 3.0 -------------------------");
19271939

19281940
info!("Pausing both miners' block commit submissions");
@@ -1969,7 +1981,7 @@ fn miner_forking() {
19691981
)
19701982
.unwrap();
19711983

1972-
// fetch the current sortition info
1984+
wait_for_chains().expect("Timed out waiting for Rl1 and Rl2 chains to advance");
19731985
let sortdb = conf.get_burnchain().open_sortition_db(true).unwrap();
19741986
let tip = SortitionDB::get_canonical_burn_chain_tip(sortdb.conn()).unwrap();
19751987
// make sure the tenure was won by RL1
@@ -2047,6 +2059,7 @@ fn miner_forking() {
20472059
.expect("RL1 did not produce a tenure extend block");
20482060

20492061
// fetch the current sortition info
2062+
wait_for_chains().expect("Timed out waiting for Rl1 and Rl2 chains to advance");
20502063
let tip = SortitionDB::get_canonical_burn_chain_tip(sortdb.conn()).unwrap();
20512064
// make sure the tenure was won by RL2
20522065
assert!(tip.sortition, "No sortition was won");
@@ -2145,6 +2158,7 @@ fn miner_forking() {
21452158
.unwrap();
21462159

21472160
// fetch the current sortition info
2161+
wait_for_chains().expect("Timed out waiting for Rl1 and Rl2 chains to advance");
21482162
let tip = SortitionDB::get_canonical_burn_chain_tip(sortdb.conn()).unwrap();
21492163
// make sure the tenure was won by RL1
21502164
assert!(tip.sortition, "No sortition was won");

0 commit comments

Comments
 (0)