diff --git a/stacks-signer/CHANGELOG.md b/stacks-signer/CHANGELOG.md index fd38fe9775..dc5507b065 100644 --- a/stacks-signer/CHANGELOG.md +++ b/stacks-signer/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE ## Changed +# [3.1.0.0.2.1] + +## Added + +## Changed + +- Prevent old reward cycle signers from processing block validation response messages that do not apply to blocks from their cycle. + ## [3.1.0.0.2.0] ## Added diff --git a/stacks-signer/src/v0/signer.rs b/stacks-signer/src/v0/signer.rs index 22a02bc107..5bf8976784 100644 --- a/stacks-signer/src/v0/signer.rs +++ b/stacks-signer/src/v0/signer.rs @@ -564,6 +564,14 @@ impl Signer { // For mutability reasons, we need to take the block_info out of the map and add it back after processing let mut block_info = match self.signer_db.block_lookup(&signer_signature_hash) { Ok(Some(block_info)) => { + if block_info.reward_cycle != self.reward_cycle { + // We are not signing for this reward cycle. Ignore the block. + debug!( + "{self}: Received a block validation response for a different reward cycle. Ignore it."; + "requested_reward_cycle" => block_info.reward_cycle, + ); + return None; + } if block_info.is_locally_finalized() { debug!("{self}: Received block validation for a block that is already marked as {}. Ignoring...", block_info.state); return None; @@ -635,6 +643,14 @@ impl Signer { } let mut block_info = match self.signer_db.block_lookup(&signer_signature_hash) { Ok(Some(block_info)) => { + if block_info.reward_cycle != self.reward_cycle { + // We are not signing for this reward cycle. Ignore the block. + debug!( + "{self}: Received a block validation response for a different reward cycle. Ignore it."; + "requested_reward_cycle" => block_info.reward_cycle, + ); + return None; + } if block_info.is_locally_finalized() { debug!("{self}: Received block validation for a block that is already marked as {}. Ignoring...", block_info.state); return None;