From c13f5ce8cc5c2f7ea38c278715b2d76c1f74c79c Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Tue, 30 Apr 2024 18:25:19 +0000 Subject: [PATCH] active epoch --- src/processor/mine.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/processor/mine.rs b/src/processor/mine.rs index 525b0ea..29bbce3 100644 --- a/src/processor/mine.rs +++ b/src/processor/mine.rs @@ -69,13 +69,13 @@ pub fn process_mine<'a, 'info>( return Err(OreError::ClockInvalid.into()); } - // TODO Validate epoch is active - // let treasury_data = treasury_info.data.borrow(); - // let treasury = Treasury::try_from_bytes(&treasury_data)?; - // let threshold = treasury.last_reset_at.saturating_add(ONE_MINUTE); - // if clock.unix_timestamp.ge(&threshold) { - // return Err(OreError::NeedsReset.into()); - // } + // Validate epoch is active + if clock + .unix_timestamp + .ge(&config.last_reset_at.saturating_add(ONE_MINUTE)) + { + return Err(OreError::NeedsReset.into()); + } // Calculate the hash from the provided nonce let hx = drillx::hash(&proof.challenge, &args.nonce);