Repository navigation
csnode: checkpoints save and check the digest of the state they hold - #87
Merged
Merged
Conversation
Every checkpoint (periodic, slow-start and shutdown) writes qs/<seq>/state_digest.bin: the wallets digest, the wallet count and a hash of the consensus settings the caches carry, and logs 'STATE DIGEST #<seq> ... checkpoint'. A quick start recomputes them from the loaded caches, logs '... checkpoint loaded', and quarantines a checkpoint whose caches do not match, so the next one is tried. A checkpoint without the file (earlier builds) loads as before. Loading or clearing the wallets now invalidates the incrementally kept digest, which a reload after a rejected checkpoint would otherwise reuse. First step of snapshots served by community nodes: a snapshot made from a checkpoint can declare the state of that checkpoint's block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The quick-start rejection line no longer contains 'STATE DIGEST #', so scripts reading the digest of a block cannot pick the rejected one. Tests: the consensus settings digest survives a checkpoint save and load (every field it covers is restored before the comparison) and changes with each of those fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step of snapshots served by community nodes (docs/specs/2026-10-24-snapshot-serving-design.md on docs/snapshot-serving, plan step 1).
What changes
qs/0) writesqs/<seq>/state_digest.bin. The file holds the wallets digest, the wallet count and a hash of the consensus settings the caches carry: block reward, mining coefficient, staking/mining flags, stage-1 time, pending settings, DPOS start, recorded special orders. The checkpoint logsSTATE DIGEST #<seq> <hex> wallets <n> checkpoint.... checkpoint loaded. A checkpoint whose caches do not match is quarantined (qs/<seq>.bad), and the next one is tried. A checkpoint without the file, from earlier builds, loads as before.NodeandBlockChainshare one formatter for the digest line. Existing lines are unchanged, so the entrypoint,snapshot-make.sh,digest_offline.shandrun.shstill parse them; the new suffixes followwallets <n>.Not consensus-relevant: logging and local checkpoint files only.
Tests: unit tests for the file format (round trip, missing, truncated or longer, unknown version), the comparison and the log line format. Robustness scenarios to run on this branch: snapshot-join, snapshot-corrupt, all-storage, all-storage-crash, lmdb-pruned-crash, lmdb-pruned-term-kill, checkpoint-ahead, storage-switch.
🤖 Generated with Claude Code