From 526648241872feaed70c0bac9e0a7fa7f9fd1546 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Thu, 21 Aug 2025 16:39:40 -0700 Subject: [PATCH] block start at --- api/src/state/block.rs | 3 +++ program/src/reset.rs | 1 + program/src/swap.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/api/src/state/block.rs b/api/src/state/block.rs index 31902a8..57a1a46 100644 --- a/api/src/state/block.rs +++ b/api/src/state/block.rs @@ -22,6 +22,9 @@ pub struct Block { /// The authority of the miner who submitted the best hash. pub best_hash_miner: Pubkey, + /// The timestamp at which the block starts mining. + pub start_at: i64, + /// The slot at which the block starts trading. pub start_slot: u64, diff --git a/program/src/reset.rs b/program/src/reset.rs index b0b6e50..222119e 100644 --- a/program/src/reset.rs +++ b/program/src/reset.rs @@ -106,6 +106,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul market.fee.cumulative = 0; // Setup the next block start and end slots. + block_next.start_at = clock.unix_timestamp; block_next.start_slot = clock.slot; block_next.end_slot = clock.slot + config.block_duration; diff --git a/program/src/swap.rs b/program/src/swap.rs index 44f4f25..43b5c25 100644 --- a/program/src/swap.rs +++ b/program/src/swap.rs @@ -197,6 +197,7 @@ fn test_sniper_fees() { reward: 0, best_hash: [0; 32], best_hash_miner: Pubkey::default(), + start_at: 0, start_slot: 0, end_slot: u64::MAX, slot_hash: [0; 32],