Skip to content

Commit 78ac7cc

Browse files
committed
crc: review comments
1 parent 66bfc13 commit 78ac7cc

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

stacks-signer/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub struct SignerConfig {
188188
/// Whether or not to validate blocks with replay transactions
189189
pub validate_with_replay_tx: bool,
190190
/// How many blocks after a fork should we reset the replay set,
191-
/// as a failsafe mechanism?
191+
/// as a failsafe mechanism
192192
pub reset_replay_set_after_fork_blocks: u64,
193193
}
194194

@@ -244,7 +244,7 @@ pub struct GlobalConfig {
244244
/// Whether or not to validate blocks with replay transactions
245245
pub validate_with_replay_tx: bool,
246246
/// How many blocks after a fork should we reset the replay set,
247-
/// as a failsafe mechanism?
247+
/// as a failsafe mechanism
248248
pub reset_replay_set_after_fork_blocks: u64,
249249
}
250250

@@ -298,7 +298,7 @@ struct RawConfigFile {
298298
/// Whether or not to validate blocks with replay transactions
299299
pub validate_with_replay_tx: Option<bool>,
300300
/// How many blocks after a fork should we reset the replay set,
301-
/// as a failsafe mechanism?
301+
/// as a failsafe mechanism
302302
pub reset_replay_set_after_fork_blocks: Option<u64>,
303303
}
304304

stacks-signer/src/v0/signer_state.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ impl LocalStateMachine {
12341234
forked_txs
12351235
}
12361236

1237-
/// If it has been 2 burn blocks since the origin of our replay set, and
1237+
/// If it has been `reset_replay_set_after_fork_blocks` burn blocks since the origin of our replay set, and
12381238
/// we haven't produced any replay blocks since then, we should reset our replay set
12391239
///
12401240
/// Returns a `bool` indicating whether the replay set should be reset.
@@ -1243,15 +1243,17 @@ impl LocalStateMachine {
12431243
new_burn_block: &NewBurnBlock,
12441244
reset_replay_set_after_fork_blocks: u64,
12451245
) -> Result<bool, SignerChainstateError> {
1246-
let ReplayState::InProgress(_, replay_scope) = replay_state else {
1247-
// Not in replay - skip
1248-
return Ok(false);
1249-
};
1250-
1251-
let failsafe_height =
1252-
replay_scope.past_tip.burn_block_height + reset_replay_set_after_fork_blocks;
1253-
1254-
Ok(new_burn_block.burn_block_height > failsafe_height)
1246+
match replay_state {
1247+
ReplayState::Unset => {
1248+
// not in replay - skip
1249+
return Ok(false);
1250+
}
1251+
ReplayState::InProgress(_, replay_scope) => {
1252+
let failsafe_height =
1253+
replay_scope.past_tip.burn_block_height + reset_replay_set_after_fork_blocks;
1254+
Ok(new_burn_block.burn_block_height > failsafe_height)
1255+
}
1256+
}
12551257
}
12561258

12571259
/// Check if the new burn block is a fork, by checking if the new burn block

0 commit comments

Comments
 (0)