Extend the hardcoded assume_valid_target
to an array.
#4742
+224
−104
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.
What problem does this PR solve?
Resolve #4518.
Follow up #4254, this PR want to hardcode an array of default_valid_targets for ckb-sync.
What is changed and how it works?
This PR aims to replace the hardcoded DEFAULT_ASSUME_VALID_TARGET in CKB with an array. After CKB starts up, the header sync process currently takes over an hour to sync headers and search for the hardcoded target within them.
By changing this target to an array, which contains selected blocks from the main chain with exponentially increasing heights, we can improve the process. As soon as the header sync reaches the first block, it can immediately start using the first target in the array as the new synchronization target, allowing for more efficient block syncing after CKB startup.
What's Changed:
Related changes
Check List
Tests
Side effects
Release note