Skip to content

Commit bbc6ab8

Browse files
committed
fix revealed flake in restarting_miner and test_shadow_recovery
1 parent 3ea5c85 commit bbc6ab8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ fn restarting_miner() {
17451745
naka_proposed_blocks: proposals_submitted_2,
17461746
..
17471747
} = run_loop_2.counters();
1748-
let rl2_counters = run_loop.counters();
1748+
let rl2_counters = run_loop_2.counters();
17491749

17501750
let run_loop_thread = thread::spawn(move || run_loop.start(None, 0));
17511751
wait_for_runloop(&blocks_processed);
@@ -1832,13 +1832,16 @@ fn restarting_miner() {
18321832
let tip = NakamotoChainState::get_canonical_block_header(chainstate.db(), &sortdb)
18331833
.unwrap()
18341834
.unwrap();
1835-
Ok(tip.stacks_block_height > last_tip.stacks_block_height)
1835+
let stacks_tip_committed_to = rl2_counters
1836+
.naka_submitted_commit_last_stacks_tip
1837+
.load(Ordering::SeqCst);
1838+
Ok(tip.stacks_block_height > last_tip.stacks_block_height
1839+
&& stacks_tip_committed_to > last_tip.stacks_block_height)
18361840
})
18371841
.unwrap_or_else(|e| {
18381842
let tip = NakamotoChainState::get_canonical_block_header(chainstate.db(), &sortdb)
18391843
.unwrap()
18401844
.unwrap();
1841-
18421845
error!(
18431846
"Failed to get a new block after restart";
18441847
"last_tip_height" => last_tip.stacks_block_height,
@@ -10043,8 +10046,7 @@ fn test_shadow_recovery() {
1004310046

1004410047
// revive ATC-C by waiting for commits
1004510048
for _i in 0..4 {
10046-
btc_regtest_controller.bootstrap_chain(1);
10047-
sleep_ms(30_000);
10049+
next_block_and_commits_only(btc_regtest_controller, 60, &naka_conf, &counters).unwrap();
1004810050
}
1004910051

1005010052
// make another tenure

0 commit comments

Comments
 (0)