Skip to content

Commit

Permalink
fix: epoch progress
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Feb 10, 2025
1 parent 8de42d4 commit 6722b11
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/core/src/simnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ use crate::{
types::{RunloopTriggerMode, SurfpoolConfig},
};

const BLOCKHASH_SLOT_TTL: u64 = 75;

#[derive(Debug, Clone)]
pub struct TransactionWithStatusMeta(
u64,
Expand Down Expand Up @@ -257,6 +259,8 @@ pub async fn start(
.start_http(&server_bind)
.unwrap();
let _ = simnet_events_tx_copy.send(SimnetEvent::Ready);
let _ = simnet_events_tx_copy.send(SimnetEvent::EpochInfoUpdate(epoch_info));

server.wait();
let _ = simnet_events_tx_copy.send(SimnetEvent::Shutdown);
});
Expand Down Expand Up @@ -289,15 +293,14 @@ pub async fn start(
if enabled {
let _ = clock_event_tx.send(ClockEvent::Tick);
// Todo: the block expiration is not completely accurate.
if block_hash_timeout.elapsed() > Duration::from_millis(75 * slot_time) {
if block_hash_timeout.elapsed() > Duration::from_millis(BLOCKHASH_SLOT_TTL * slot_time) {
let _ = clock_event_tx.send(ClockEvent::ExpireBlockHash);
block_hash_timeout = Instant::now();
}
}
}
});

let _ = simnet_events_tx.send(SimnetEvent::EpochInfoUpdate(epoch_info.clone()));
let mut runloop_trigger_mode = config.simnet.runloop_trigger_mode.clone();
let mut transactions_to_process = vec![];
loop {
Expand Down

0 comments on commit 6722b11

Please sign in to comment.