Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Fix signer_set_rollover. Use the old signer set when at a reward cycl…
Browse files Browse the repository at this point in the history
…e boundary

Signed-off-by: Jacinta Ferrant <[email protected]>
  • Loading branch information
jferrant committed Aug 20, 2024
1 parent 7a73f92 commit 11de2a3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions testnet/stacks-node/src/tests/signer/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ impl SignerTest<SpawnedSigner> {
fn mine_and_verify_confirmed_naka_block(&mut self, timeout: Duration, num_signers: usize) {
info!("------------------------- Try mining one block -------------------------");

let old_reward_cycle = self.get_current_reward_cycle();

self.mine_nakamoto_block(timeout);

// Verify that the signers accepted the proposed block, sending back a validate ok response
Expand All @@ -311,7 +313,16 @@ impl SignerTest<SpawnedSigner> {
// whenever it has crossed the threshold.
assert!(signature.len() >= num_signers * 7 / 10);

let reward_cycle = self.get_current_reward_cycle();
let new_reward_cycle = self.get_current_reward_cycle();
let reward_cycle = if new_reward_cycle != old_reward_cycle {
old_reward_cycle
} else {
new_reward_cycle
};
info!(
"Verifying signatures against signers for reward cycle {:?}",
reward_cycle
);
let signers = self.get_reward_set_signers(reward_cycle);

// Verify that the signers signed the proposed block
Expand Down Expand Up @@ -2784,8 +2795,7 @@ fn signer_set_rollover() {
.running_nodes
.btc_regtest_controller
.get_burnchain()
.reward_cycle_to_block_height(next_reward_cycle)
.saturating_add(1);
.reward_cycle_to_block_height(next_reward_cycle);

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

0 comments on commit 11de2a3

Please sign in to comment.