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
multi: Introduce AssumeValid. #2839
Commits on Dec 5, 2021
-
chaincfg: Add AssumeValid param.
This introduces an AssumeValid parameter that is the hash of a block that has been externally verified to be valid. In a subsequent commit, it will be used to allow several validation checks to be skipped for blocks that are both an ancestor of the assumed valid block and an ancestor of the best header. Note that the AssumeValid block hash that is specified for mainnet and testnet is for the same block that was used for MinKnownChainWork. Using the same block for both of these slightly simplifies the process for external verification of the values when they are updated periodically with new releases.
Configuration menu - View commit details
-
Copy full SHA for cf002c4 - Browse repository at this point
Copy the full SHA cf002c4View commit details -
multi: Add assumeValid to BlockChain.
This adds an assumeValid field to BlockChain and sets it based on the AssumeValid chain parameter.
Configuration menu - View commit details
-
Copy full SHA for 3801b11 - Browse repository at this point
Copy the full SHA 3801b11View commit details -
blockchain: Track assumed valid node.
This adds tracking of the assumed valid node to BlockChain. The assumed valid node will be used in place of checkpoints to set the BFFastAdd flag in a subsequent commit.
Configuration menu - View commit details
-
Copy full SHA for 7037dee - Browse repository at this point
Copy the full SHA 7037deeView commit details -
blockchain: Set BFFastAdd based on assume valid.
This updates BlockChain to set the BFFastAdd flag if a block is both an ancestor of the assumed valid block and an ancestor of the best header. A helper function isAssumeValidAncestor is introduced that determines whether the provided node is both an ancestor of the assumed valid node and an ancestor of the best header. False is returned when the assume valid node has not been discovered or when assume valid is disabled. The assumed valid node is clamped back as needed to ensure that it is at least 2 weeks worth of blocks behind the best header. This protects against malicious actors trying to play games by tricking users into using an assumed valid hash near the tip.
Configuration menu - View commit details
-
Copy full SHA for a35ef9a - Browse repository at this point
Copy the full SHA a35ef9aView commit details -
blockchain: Assume valid skip script validation.
This updates block validation to not run scripts if a block is both an ancestor of the assumed valid block and an ancestor of the best header.
Configuration menu - View commit details
-
Copy full SHA for 628cd34 - Browse repository at this point
Copy the full SHA 628cd34View commit details -
blockchain: Bulk import skip script validation.
This updates block validation to not run scripts if bulk import mode is enabled. Bulk import mode is only enabled when importing blocks that are already known to be valid.
Configuration menu - View commit details
-
Copy full SHA for e09b817 - Browse repository at this point
Copy the full SHA e09b817View commit details -
blockchain: Add AssumeValid tests.
This adds tests that validate that it is correctly determined whether or not a node is an ancestor of an assumed valid node under a variety of conditions.
Configuration menu - View commit details
-
Copy full SHA for f67415c - Browse repository at this point
Copy the full SHA f67415cView commit details -
multi: Add assumevalid config option.
This adds an assumevalid config option which allows for specifying a hash of an assumed valid block or disabling assume valid. The usage is as follows: * (flag not specified): defaults to the hard-coded value in source * --assumevalid=0: disable AssumeValid * --assumevalid=[blockhash]: set AssumeValid to the specified block hash
Configuration menu - View commit details
-
Copy full SHA for 288b106 - Browse repository at this point
Copy the full SHA 288b106View commit details