Skip to content

Commit efe0f60

Browse files
committed
crc: refactor fault injection to skip replay txs, #5971
1 parent 7c0c231 commit efe0f60

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

stackslib/src/chainstate/stacks/miner.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub static TEST_MINE_ALLOWED_REPLAY_TXS: LazyLock<TestFlag<Vec<String>>> =
9191
/// Given a tx id, check if it is should be skipped
9292
/// if not listed in `TEST_MINE_ALLOWED_REPLAY_TXS` flag.
9393
/// If flag is empty means no tx should be skipped
94-
fn should_skip_replay_tx(tx_id: Txid) -> bool {
94+
fn fault_injection_should_skip_replay_tx(tx_id: Txid) -> bool {
9595
let minable_txs = TEST_MINE_ALLOWED_REPLAY_TXS.get();
9696
let allowed =
9797
minable_txs.len() == 0 || minable_txs.iter().any(|tx_ids| *tx_ids == tx_id.to_hex());
@@ -104,6 +104,14 @@ fn should_skip_replay_tx(tx_id: Txid) -> bool {
104104
!allowed
105105
}
106106

107+
#[cfg(not(any(test, feature = "testing")))]
108+
/// Given a tx id, check if it is should be skipped
109+
/// if not listed in `TEST_MINE_ALLOWED_REPLAY_TXS` flag.
110+
/// If flag is empty means no tx should be skipped
111+
fn fault_injection_should_skip_replay_tx(_tx_id: Txid) -> bool {
112+
false
113+
}
114+
107115
/// Fully-assembled Stacks anchored, block as well as some extra metadata pertaining to how it was
108116
/// linked to the burnchain and what view(s) the miner had of the burnchain before and after
109117
/// completing the block.
@@ -3014,11 +3022,8 @@ fn select_and_apply_transactions_from_vec<B: BlockBuilder>(
30143022
debug!("Replay block transaction selection begins (parent height = {tip_height})");
30153023
for replay_tx in replay_transactions {
30163024
fault_injection_stall_tx();
3017-
#[cfg(any(test, feature = "testing"))]
3018-
{
3019-
if should_skip_replay_tx(replay_tx.txid()) {
3020-
continue;
3021-
}
3025+
if fault_injection_should_skip_replay_tx(replay_tx.txid()) {
3026+
continue;
30223027
}
30233028

30243029
let txid = replay_tx.txid();

0 commit comments

Comments
 (0)