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
2 changes: 1 addition & 1 deletion checkpoint/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn main() -> anyhow::Result<()> {
eprintln!("SHA-256: {}", hex::encode(digest));

if let Some(path) = args.integrity_out.as_deref() {
spaces_checkpoint::write_integrity(path, height, &block_hash, &digest)?;
spaces_checkpoint::write_integrity_to(path, height, &block_hash, &digest)?;
eprintln!("Updated {}", path.display());
}

Expand Down
14 changes: 13 additions & 1 deletion checkpoint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,21 @@ pub fn checkpoint() -> super::Checkpoint {{
)
}

/// Write the checkpoint constant to `checkpoint/src/integrity.rs` relative to
/// the current working directory. Must be run from the workspace root.
#[cfg(feature = "cli")]
pub fn write_integrity(height: u32, block_hash: &str, digest: &[u8; 32]) -> anyhow::Result<()> {
write_integrity_to(
Path::new("checkpoint/src/integrity.rs"),
height,
block_hash,
digest,
)
}

/// Write the checkpoint constant to a Rust source file at `path`.
#[cfg(feature = "cli")]
pub fn write_integrity(
pub fn write_integrity_to(
path: &Path,
height: u32,
block_hash: &str,
Expand Down
Loading