blockchain: Make checkpoints configurable. #2013
Merged
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.
This is rebased on PR #2012.
This modifies blockchain to expose a new field named
Checkpoints
in theConfig
struct which allows the checkpoints to use to be specified by the caller instead of assuming the checkpoint associated with the current chain parameters. This allows the caller to customize the checkpoints as it sees fit, such as adding custom checkpoints or removing default checkpoints.In addition, this removes the
DisableCheckpoints
function in favor of the caller simply configuring the chain instance without checkpoints when they're disabled and updates the code to remove the associated flag accordingly. This produces simpler code and is faster since the mutex that was required to protect the aforementioned flag is no longer required.Finally, this also paves the way to significantly simplify the checkpoint finding logic and make further progress towards the overall effort to decouple the connection code from the download logic.