Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockchain: Make checkpoints configurable. #2013

Merged
merged 2 commits into from
Dec 6, 2019

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Nov 27, 2019

This is rebased on PR #2012.

This modifies blockchain to expose a new field named Checkpoints in the Config 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.

blockchain/chain.go Outdated Show resolved Hide resolved
These checks are no longer necessary since they applied to orphans and
blockchain no longer handles orphans.  Further, orphans are currently
otherwise limited by the block manager and this is another step towards
the overall effort to decouple the connection code from the download
logic.  Ultimately, the goal is to remove orphan handling altogether.

Finally, it also has the added benefit of further minimizing the
reliance on trusted known good checkpoints.
This modifies blockchain to expose a new field named Checkpoints in the
Config 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.
@davecgh davecgh force-pushed the blockchain_configurable_checkpoints branch from 3a303d2 to 4da1216 Compare December 6, 2019 03:47
@davecgh davecgh merged commit 4da1216 into decred:master Dec 6, 2019
@davecgh davecgh deleted the blockchain_configurable_checkpoints branch December 6, 2019 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants