Support for a partial chain
This MR attempts to solve item 2 of #339 (closed).
It edits the predecessor access functions in module State
so as to handle the possibility that a block may be known and validated without it having its predecessor in the database.
It also creates the prune
, delete
and purge
function.
-
prune store hash
removes most information about a block, leaving only its header information. Blocks withinmax_operation_ttl
of a block you would want to validate on must have this data. -
delete store hash
removes all information from a block. -
purge chain hash
first prunes all block information, starting from the blockb
referenced by thehash
down to the one indexed by min(max_op_ttl(b), level(b)) beforeb
. Then it deletes all block information from the predecessor of this block down to the end of the chain.
Note that as of right now, the context information is not deleted from the database. This shall be done when item 3 of #339 (closed) is completed.
Potential problem: the logarithmic predecessor lookup has not been changed.