From f910e6d3821d4e30864aae5fb5b31621ecce7796 Mon Sep 17 00:00:00 2001 From: Jeff Bencin Date: Mon, 29 Apr 2024 13:21:08 -0400 Subject: [PATCH] fix: Unit tests pass --- stackslib/src/chainstate/stacks/miner.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/stackslib/src/chainstate/stacks/miner.rs b/stackslib/src/chainstate/stacks/miner.rs index ec8ac4a36c..64b131c17c 100644 --- a/stackslib/src/chainstate/stacks/miner.rs +++ b/stackslib/src/chainstate/stacks/miner.rs @@ -2580,9 +2580,11 @@ impl BlockBuilder for StacksBlockBuilder { } // preemptively skip problematic transactions + let epoch_id = clarity_tx.get_epoch(); + if let Err(e) = Relayer::static_check_problematic_relayed_tx( clarity_tx.config.mainnet, - clarity_tx.get_epoch(), + epoch_id, &tx, ast_rules, ) { @@ -2592,6 +2594,19 @@ impl BlockBuilder for StacksBlockBuilder { ); return TransactionResult::problematic(&tx, Error::NetError(e)); } + + if !StacksBlock::validate_transactions_static_epoch(&[tx.clone()], epoch_id) { + let msg = format!( + "Invalid transaction {}: target epoch is not activated", + tx.txid() + ); + warn!("{msg}"); + return TransactionResult::skipped_due_to_error( + tx, + Error::InvalidStacksTransaction(msg, false), + ); + } + let (fee, receipt) = match StacksChainState::process_transaction( clarity_tx, tx, quiet, ast_rules, ) {