Skip to content

Commit

Permalink
Merge pull request #5707 from stacks-network/fix/miner-forking
Browse files Browse the repository at this point in the history
Fix miner_forking test
  • Loading branch information
jferrant authored Jan 17, 2025
2 parents c88eea5 + 2bf2129 commit 403aefc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion testnet/stacks-node/src/tests/signer/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,18 @@ fn miner_forking() {
.unwrap()
.block_height
};

let wait_for_chains = || {
wait_for(30, || {
let Some(chain_info_1) = get_chain_info_opt(&conf) else {
return Ok(false);
};
let Some(chain_info_2) = get_chain_info_opt(&conf_node_2) else {
return Ok(false);
};
Ok(chain_info_1.burn_block_height == chain_info_2.burn_block_height)
})
};
info!("------------------------- Reached Epoch 3.0 -------------------------");

info!("Pausing both miners' block commit submissions");
Expand Down Expand Up @@ -1969,7 +1981,7 @@ fn miner_forking() {
)
.unwrap();

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

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

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

0 comments on commit 403aefc

Please sign in to comment.