Skip to main content

update_checkpoint_cache

Function update_checkpoint_cache 

Source
pub fn update_checkpoint_cache(
    store: &dyn ConfigStore,
    cache_path: &Path,
    new_checkpoint: &SignedCheckpoint,
    consistency_proof: &ConsistencyProof,
    _trust_root: &TrustRoot,
    _now: DateTime<Utc>,
) -> Result<ConsistencyReport, TransparencyWorkflowError>
Expand description

Update the local checkpoint cache after verifying consistency.

Loads the cached checkpoint from disk, verifies that the new checkpoint is a consistent append-only extension of the cached one, and writes the new checkpoint to disk.

Args:

  • store — File-access port for the checkpoint cache file.
  • cache_path — Path to the cached checkpoint JSON file.
  • new_checkpoint — The newly received signed checkpoint.
  • consistency_proof — Proof that old tree is a prefix of the new tree.
  • _trust_root — Trust root for checkpoint signature verification (reserved for future use).
  • _now — Injected wall-clock time (reserved for future use).

Usage:

let report = update_checkpoint_cache(
    &store,
    &cache_path,
    &new_checkpoint,
    &consistency_proof,
    &trust_root,
    now,
)?;