Skip to content

Commit cbf0c52

Browse files
authored
Merge pull request #5087 from stacks-network/bugfix/mine-2-nakamoto-reward-cycles
bugfix/boot_to_epoch_3 in SignerTest should wait for a new commit
2 parents 15827e8 + 51e46fa commit cbf0c52

File tree

1 file changed

+9
-6
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ impl SignerTest<SpawnedSigner> {
278278
self.run_until_epoch_3_boundary();
279279

280280
let commits_submitted = self.running_nodes.commits_submitted.clone();
281-
281+
let commits_before = commits_submitted.load(Ordering::SeqCst);
282282
info!("Waiting 1 burnchain block for miner VRF key confirmation");
283283
// Wait one block to confirm the VRF register, wait until a block commit is submitted
284284
next_block_and(&mut self.running_nodes.btc_regtest_controller, 60, || {
285285
let commits_count = commits_submitted.load(Ordering::SeqCst);
286-
Ok(commits_count >= 1)
286+
Ok(commits_count > commits_before)
287287
})
288288
.unwrap();
289289
info!("Ready to mine Nakamoto blocks!");
@@ -293,6 +293,8 @@ impl SignerTest<SpawnedSigner> {
293293
fn mine_and_verify_confirmed_naka_block(&mut self, timeout: Duration, num_signers: usize) {
294294
info!("------------------------- Try mining one block -------------------------");
295295

296+
let reward_cycle = self.get_current_reward_cycle();
297+
296298
self.mine_nakamoto_block(timeout);
297299

298300
// Verify that the signers accepted the proposed block, sending back a validate ok response
@@ -310,8 +312,10 @@ impl SignerTest<SpawnedSigner> {
310312
// NOTE: signature.len() does not need to equal signers.len(); the stacks miner can finish the block
311313
// whenever it has crossed the threshold.
312314
assert!(signature.len() >= num_signers * 7 / 10);
313-
314-
let reward_cycle = self.get_current_reward_cycle();
315+
info!(
316+
"Verifying signatures against signers for reward cycle {:?}",
317+
reward_cycle
318+
);
315319
let signers = self.get_reward_set_signers(reward_cycle);
316320

317321
// Verify that the signers signed the proposed block
@@ -2784,8 +2788,7 @@ fn signer_set_rollover() {
27842788
.running_nodes
27852789
.btc_regtest_controller
27862790
.get_burnchain()
2787-
.reward_cycle_to_block_height(next_reward_cycle)
2788-
.saturating_add(1);
2791+
.reward_cycle_to_block_height(next_reward_cycle);
27892792

27902793
info!("---- Mining to next reward set calculation -----");
27912794
signer_test.run_until_burnchain_height_nakamoto(

0 commit comments

Comments
 (0)