Skip to content

Commit 36e71aa

Browse files
committed
refactor: add test version of StacksEpochId::latest()
The test implementation returns epoch 3.3 while the non-test version returns 3.2.
1 parent 46fdd6b commit 36e71aa

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

stacks-common/src/types/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,12 @@ impl SIP031EmissionInterval {
431431
}
432432

433433
impl StacksEpochId {
434+
#[cfg(any(test, feature = "testing"))]
435+
pub const fn latest() -> StacksEpochId {
436+
StacksEpochId::Epoch33
437+
}
438+
439+
#[cfg(not(any(test, feature = "testing")))]
434440
pub const fn latest() -> StacksEpochId {
435441
StacksEpochId::Epoch32
436442
}

stacks-node/src/nakamoto_node/relayer.rs

Lines changed: 2 additions & 6 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::{marker_for_epoch, STACKS_EPOCH_LATEST_MARKER};
47+
use stacks::core::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,11 +1139,7 @@ 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: 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-
},
1142+
memo: vec![STACKS_EPOCH_LATEST_MARKER],
11471143
new_seed: VRFSeed::from_proof(&tip_vrf_proof),
11481144
parent_block_ptr: u32::try_from(commit_parent_block_burn_height)
11491145
.expect("FATAL: burn block height exceeded u32"),

0 commit comments

Comments
 (0)