diff --git a/zebra-state/src/service/check.rs b/zebra-state/src/service/check.rs index cd5c9d33..b075a07c 100644 --- a/zebra-state/src/service/check.rs +++ b/zebra-state/src/service/check.rs @@ -14,9 +14,7 @@ use crate::{PreparedBlock, ValidateContextError}; use super::check; -use difficulty::{ - AdjustedDifficulty, BLOCK_MAX_TIME_TESTNET_ACTIVATION_HEIGHT, POW_MEDIAN_BLOCK_SPAN, -}; +use difficulty::{AdjustedDifficulty, POW_MEDIAN_BLOCK_SPAN, TESTNET_MAX_TIME_START_HEIGHT}; pub(crate) mod difficulty; @@ -150,8 +148,8 @@ fn difficulty_threshold_is_valid( })? } - // The maximum time rule is only active on Testnet from height 653606 onwards - if (network == Network::Mainnet || candidate_height >= BLOCK_MAX_TIME_TESTNET_ACTIVATION_HEIGHT) + // The maximum time rule is only active on Testnet from a specific height + if (network == Network::Mainnet || candidate_height >= TESTNET_MAX_TIME_START_HEIGHT) && candidate_time > block_time_max { Err(ValidateContextError::TimeTooLate { diff --git a/zebra-state/src/service/check/difficulty.rs b/zebra-state/src/service/check/difficulty.rs index cc087e94..8347baa9 100644 --- a/zebra-state/src/service/check/difficulty.rs +++ b/zebra-state/src/service/check/difficulty.rs @@ -45,7 +45,7 @@ pub const BLOCK_MAX_TIME_SINCE_MEDIAN: i64 = 90 * 60; /// The activation height for the block maximum time rule on Testnet. /// /// Part of the block header consensus rules in the Zcash specification. -pub const BLOCK_MAX_TIME_TESTNET_ACTIVATION_HEIGHT: block::Height = block::Height(653606); +pub const TESTNET_MAX_TIME_START_HEIGHT: block::Height = block::Height(653_606); /// Contains the context needed to calculate the adjusted difficulty for a block. pub(super) struct AdjustedDifficulty {