Skip to content

Commit 11de2a3

Browse files
committed
Fix signer_set_rollover. Use the old signer set when at a reward cycle boundary
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 7a73f92 commit 11de2a3

File tree

1 file changed

+13
-3
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 old_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
@@ -311,7 +313,16 @@ impl SignerTest<SpawnedSigner> {
311313
// whenever it has crossed the threshold.
312314
assert!(signature.len() >= num_signers * 7 / 10);
313315

314-
let reward_cycle = self.get_current_reward_cycle();
316+
let new_reward_cycle = self.get_current_reward_cycle();
317+
let reward_cycle = if new_reward_cycle != old_reward_cycle {
318+
old_reward_cycle
319+
} else {
320+
new_reward_cycle
321+
};
322+
info!(
323+
"Verifying signatures against signers for reward cycle {:?}",
324+
reward_cycle
325+
);
315326
let signers = self.get_reward_set_signers(reward_cycle);
316327

317328
// Verify that the signers signed the proposed block
@@ -2784,8 +2795,7 @@ fn signer_set_rollover() {
27842795
.running_nodes
27852796
.btc_regtest_controller
27862797
.get_burnchain()
2787-
.reward_cycle_to_block_height(next_reward_cycle)
2788-
.saturating_add(1);
2798+
.reward_cycle_to_block_height(next_reward_cycle);
27892799

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

0 commit comments

Comments
 (0)