treat rewriting identical genesis block as no-op in state history log #507
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.
Prior to leap 3.2, when writing a state history log entry with a block number less than the log's head block number, the log would be truncated to the new lower block number (truncated as in the file's contents are removed entirely).
This behavior allowed an accidental erasure of the entire state history log (see AntelopeIO/leap#659), so in leap 3.2 (AntelopeIO/leap#737) the behavior was modified: writing the genesis block in to a non empty state history log was immediately assert failure, and writing any other blocks in to the log would only truncate the log if the blockid is different; otherwise the logs were left unaltered.
But that change has a side effect that makes it impossible to replay a chain from genesis while keeping the state history logs intact (see #413). So instead, modify behavior such that writing any existing block -- even the genesis block -- with the same blockid is treated as a "no-op" (logs left unaltered), and disallowing rewriting the genesis block with a different blockid.
Resolves #413