Skip to content

Commit 2abb5cd

Browse files
committed
feat: clear tx_replay_set when a new block is mined
1 parent 2e67706 commit 2abb5cd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

stacks-signer/src/v0/signer_state.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ impl LocalStateMachine {
643643
}
644644
};
645645

646+
// No matter what, if we're in tx replay mode, remove the tx replay set
647+
prior_state_machine.tx_replay_set = None;
648+
646649
let MinerState::ActiveMiner {
647650
parent_tenure_id,
648651
parent_tenure_last_block,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,6 +2901,16 @@ fn tx_replay_forking_test() {
29012901

29022902
TEST_MINE_STALL.set(false);
29032903

2904+
// Now, make a new stacks block, which should clear the tx replay set
2905+
signer_test.mine_nakamoto_block(Duration::from_secs(30), true);
2906+
let (signer_states, _) = signer_test.get_burn_updated_states();
2907+
for state in signer_states {
2908+
assert!(
2909+
state.get_tx_replay_set().is_none(),
2910+
"Signer state is in tx replay state, when it shouldn't be"
2911+
);
2912+
}
2913+
29042914
signer_test.shutdown();
29052915
}
29062916

0 commit comments

Comments
 (0)