fn start_interval_block_production(
    eid: sgx_enclave_id_t,
    api: &Api<sr25519::Pair>,
    mut latest_head: Header,
) {
    let block_production_interval = Duration::from_millis(BLOCK_PRODUCTION_INTERVAL);
    let mut interval_start = SystemTime::now();
    loop {
        if let Ok(elapsed) = interval_start.elapsed() {
            if elapsed >= block_production_interval {
                // update interval time
                interval_start = SystemTime::now();
                latest_head = produce_blocks(eid, api, latest_head)
            } else {
                // sleep for the rest of the interval
                let sleep_time = block_production_interval - elapsed;
                thread::sleep(sleep_time);
            }
        }
    }
}
/// Triggers the enclave to produce a block based on a fixed time schedule
Triggers the enclave to produce a block based on a fixed time schedule
Triggers the enclave to produce a block based on a fixed time schedule
fn start_interval_block_production(
    eid: sgx_enclave_id_t,
    api: &Api<sr25519::Pair>,
    mut latest_head: Header,
) {
    let block_production_interval = Duration::from_millis(BLOCK_PRODUCTION_INTERVAL);
    let mut interval_start = SystemTime::now();
    loop {
        if let Ok(elapsed) = interval_start.elapsed() {
            if elapsed >= block_production_interval {
                // update interval time
                interval_start = SystemTime::now();
                latest_head = produce_blocks(eid, api, latest_head)
            } else {
                // sleep for the rest of the interval
                let sleep_time = block_production_interval - elapsed;
                thread::sleep(sleep_time);
            }
        }
    }
}
fn start_interval_block_production ( eid : sgx_enclave_id_t , api : & Api < sr25519 :: Pair > , mut latest_head : Header , ) { let block_production_interval = Duration :: from_millis ( BLOCK_PRODUCTION_INTERVAL ) ; let mut interval_start = SystemTime :: now ( ) ; loop { if let Ok ( elapsed ) = interval_start . elapsed ( ) { if elapsed >= block_production_interval { // update interval time interval_start = SystemTime :: now ( ) ; latest_head = produce_blocks ( eid , api , latest_head ) } else { // sleep for the rest of the interval let sleep_time = block_production_interval - elapsed ; thread :: sleep ( sleep_time ) ; } } } }
Triggers the enclave to produce a block based on a fixed time schedule
Triggers the enclave to produce a block based on a fixed time schedule
eid
sgx_enclave_id_t
api
&Api<sr25519::Pair>
latest_head
Header
eid
sgx_enclave_id_t
api
&Api<sr25519::Pair>
latest_head
Header