Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/mtc_worker/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ pub struct LogParams {
pub clean_interval_secs: u64,
}

impl LogParams {
/// Return the maximum number of landmarks that cover unexpired certificates at any given time.
pub fn max_landmarks(&self) -> usize {
self.max_certificate_lifetime_secs
.div_ceil(self.landmark_interval_secs)
+ 1
}
}

fn default_u8<const V: u8>() -> u8 {
V
}
Expand Down
10 changes: 3 additions & 7 deletions crates/mtc_worker/src/frontend_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,9 @@ async fn get_landmark_sequence(
return Err("failed to get landmark sequence".into());
};

let max_landmarks = params
.max_certificate_lifetime_secs
.div_ceil(params.landmark_interval_secs)
+ 1;

let landmark_sequence = LandmarkSequence::from_bytes(&landmark_sequence_bytes, max_landmarks)
.map_err(|e| e.to_string())?;
let landmark_sequence =
LandmarkSequence::from_bytes(&landmark_sequence_bytes, params.max_landmarks())
.map_err(|e| e.to_string())?;

Ok(landmark_sequence)
}
Expand Down
5 changes: 1 addition & 4 deletions crates/mtc_worker/src/sequencer_do.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ fn checkpoint_callback(env: &Env, name: &str) -> CheckpointCallbacker {
}

// Time to add a new landmark.
let max_landmarks = params
.max_certificate_lifetime_secs
.div_ceil(params.landmark_interval_secs)
+ 1;
let max_landmarks = params.max_landmarks();

// Load current landmark sequence.
let mut seq =
Expand Down