Skip to content

Commit 2c29ff1

Browse files
evanlinjinclaude
andcommitted
docs(core): Add module-level docs for checkpoint_entry
Explain the purpose of `CheckPointEntry` and its two variants: - `Occupied`: real checkpoint at this height - `Placeholder`: implied by `prev_blockhash` from checkpoint above Also fix typo: "atleast" → "at least" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5c1fd23 commit 2c29ff1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

crates/chain/src/local_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ where
263263
CheckPoint::from_blocks(blocks)
264264
.map(|tip| Self { tip })
265265
.map_err(|err| {
266-
let last_cp = err.expect("must have atleast one block (genesis)");
266+
let last_cp = err.expect("must have at least one block (genesis)");
267267
ApplyBlockError::PrevBlockhashMismatch {
268268
expected: last_cp.block_id(),
269269
}

crates/core/src/checkpoint_entry.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
//! Checkpoint entries for `prev_blockhash`-aware iteration.
2+
//!
3+
//! A [`CheckPoint`] chain may have gaps (non-contiguous heights). However, each checkpoint's
4+
//! data can include a `prev_blockhash` that references the block one height below. This module
5+
//! provides [`CheckPointEntry`], which represents either:
6+
//!
7+
//! - **Occupied**: A real checkpoint stored at this height.
8+
//! - **Placeholder**: No checkpoint exists at this height, but the checkpoint above references it
9+
//! via `prev_blockhash`. The placeholder contains the implied [`BlockId`].
10+
//!
11+
//! Use [`CheckPoint::entry_iter`] to iterate over entries, which yields placeholders for any
12+
//! gaps where `prev_blockhash` implies a block.
13+
114
use core::ops::RangeBounds;
215

316
use bitcoin::BlockHash;

0 commit comments

Comments
 (0)