Expand description
Replays the state patches of cold history and checks them against the headers.
The XRPLA archive carries no state trees, so the patches in its cold segments
have never been compared with AccountHash, and nothing serves them. This
does the comparison: start from the whole state at one ledger, apply each
following ledger’s patches, and require the rebuilt root to equal the header’s
AccountHash on every ledger. The first ledger that differs stops the replay,
so everything before it is known to be good.
The tree is held in memory, one SubTree for each slot at LEVEL_DEPTH, as
leaf hashes and inner nodes only: the objects themselves are not kept. Only
the slots a ledger changed are hashed again, on several threads when there
are enough of them. Patches are read and their leaves hashed ahead, on
reader threads.
A checkpoint holds the leaves and the header of one ledger whose root
matched. It checks itself: loaded again, its leaves must give that header’s
AccountHash, and the header must be the one in the cold history.
Structs§
- Options
- How to run a replay.
- Progress
- What a replay went through.
- State
Tree - The state tree during a replay.
Functions§
- latest
- The latest checkpoint in
dir, if any. - load
- Reads a checkpoint into
tree, which must be empty. Returns the header and the counters. The caller’s replay then checks the root against the header. - replay
- Replays
from + 1..=toovertree, which holds the state atfromwith headerbase;beforeis what earlier runs did, for the counters. The error names the first ledger that doesn’t hold;Progressin theErris what did. - save
- Writes a checkpoint for the ledger with header
rawand keeps only the latest two.