-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blockchain: Reconstruct headers from block nodes.
This modifies the block node structure to include a couple of extra fields needed to be able to reconstruct the block header from a node, and exposes a new function from chain to fetch the block headers which takes advantage of the new functionality to reconstruct the headers from memory when possible. Finally, it updates both the p2p and RPC servers to make use of the new function. This is useful since many of the block header fields need to be kept in order to form the block index anyways and storing the extra fields means the database does not have to be consulted when headers are requested if the associated node is still in memory. The following timings show representative performance gains as measured from one system: new: Time to fetch 100000 headers: 59ms old: Time to fetch 100000 headers: 4783ms
- Loading branch information
Showing
3 changed files
with
80 additions
and
83 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
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
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