Files
pezkuwi-subxt/substrate/client/state-db
Bastian Köcher b0d0fb31d8 sc-state-db: Keep track of LAST_PRUNED after warp syncing (#2228)
When warp syncing we import the target block with all its state.
However, we didn't store the `LAST_PRUNED` block which would then lead
to `pruning` to forget about the imported block after a restart of the
node. We just set `LAST_PRUNED` to the parent block of the warp sync
target block to fix this issue.
2023-11-09 21:44:23 +01:00
..
2023-08-29 13:39:41 +02:00
2023-09-04 12:02:32 +03:00

State database maintenance. Handles canonicalization and pruning in the database. The input to this module is a ChangeSet which is basically a list of key-value pairs (trie nodes) that were added or deleted during block execution.

Canonicalization

Canonicalization window tracks a tree of blocks identified by header hash. The in-memory overlay allows to get any node that was inserted in any of the blocks within the window. The tree is journaled to the backing database and rebuilt on startup. Canonicalization function selects one root from the top of the tree and discards all other roots and their subtrees.

Pruning

See RefWindow for pruning algorithm details. StateDb prunes on each canonicalization until pruning constraints are satisfied.

License: GPL-3.0-or-later WITH Classpath-exception-2.0