Skip to content

Commit 46fdd6b

Browse files
committed
fix: allow testing with latest epoch before it is fully supported
Also harden the `test_epoch_3_3_activation` test a bit.
1 parent 0b862ec commit 46fdd6b

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

stacks-node/src/nakamoto_node/relayer.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use stacks::chainstate::stacks::miner::{
4444
use stacks::chainstate::stacks::Error as ChainstateError;
4545
use stacks::config::BurnchainConfig;
4646
use stacks::core::mempool::MemPoolDB;
47-
use stacks::core::STACKS_EPOCH_LATEST_MARKER;
47+
use stacks::core::{marker_for_epoch, STACKS_EPOCH_LATEST_MARKER};
4848
use stacks::monitoring::increment_stx_blocks_mined_counter;
4949
use stacks::net::db::LocalPeer;
5050
use stacks::net::p2p::NetworkHandle;
@@ -1139,7 +1139,11 @@ impl RelayerThread {
11391139
key_block_ptr: u32::try_from(key.block_height)
11401140
.expect("FATAL: burn block height exceeded u32"),
11411141
key_vtxindex: u16::try_from(key.op_vtxindex).expect("FATAL: vtxindex exceeded u16"),
1142-
memo: vec![STACKS_EPOCH_LATEST_MARKER],
1142+
memo: if cfg!(test) && target_epoch.epoch_id > StacksEpochId::latest() {
1143+
vec![marker_for_epoch(target_epoch.epoch_id).expect("Unsupported epoch")]
1144+
} else {
1145+
vec![STACKS_EPOCH_LATEST_MARKER]
1146+
},
11431147
new_seed: VRFSeed::from_proof(&tip_vrf_proof),
11441148
parent_block_ptr: u32::try_from(commit_parent_block_burn_height)
11451149
.expect("FATAL: burn block height exceeded u32"),

stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14101,16 +14101,17 @@ fn test_epoch_3_3_activation() {
1410114101

1410214102
// mine until epoch 3.3 height
1410314103
loop {
14104-
let commits_before = commits_submitted.load(Ordering::SeqCst);
1410514104
next_block_and_process_new_stacks_block(&mut btc_regtest_controller, 60, &coord_channel)
1410614105
.unwrap();
14107-
wait_for(20, || {
14108-
Ok(commits_submitted.load(Ordering::SeqCst) > commits_before)
14109-
})
14110-
.unwrap();
1411114106

14112-
let node_info = get_chain_info_opt(&naka_conf).unwrap();
14113-
if node_info.burn_block_height
14107+
// once we actually get a block in epoch 3.3, exit
14108+
let blocks = test_observer::get_blocks();
14109+
let last_block = blocks.last().unwrap();
14110+
if last_block
14111+
.get("burn_block_height")
14112+
.unwrap()
14113+
.as_u64()
14114+
.unwrap()
1411414115
>= naka_conf.burnchain.epochs.as_ref().unwrap()[StacksEpochId::Epoch33].start_height
1411514116
{
1411614117
break;

0 commit comments

Comments
 (0)