-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blockchain: Optimize block locator generation.
This significantly optimizes and simplifies the generation of block locators by making use of the fact that all block nodes are now in memory and therefore it is no longer necessary to consult the database for the hashes or worry about issues related to dynamic loading of nodes. Also, it slightly modifies the algorithm so that the doubling doesn't start for one additional iteration in order to mirror the upstream code. Due to the way block locators are used, this does not change any semantics in terms of requesting and locating blocks. Finally, the semantics of BlockLocatorFromHash have been changed to return a locator for the current tip in the case the hash is unknown. This is preferable since only including the passed block hash, when it isn't known, could end up leading to causing a redownload of the entire chain under certain circumstances.
- Loading branch information
Showing
1 changed file
with
69 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters