-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Make initial block index loading faster #1420
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -43,6 +43,11 @@ static const int64_t nMaxBlockDBAndTxIndexCache = 1024; | |||||||||||||||||||||||||
//! Max memory allocated to coin DB specific cache (MiB) | ||||||||||||||||||||||||||
static const int64_t nMaxCoinsDBCache = 8; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
//! By default don't check block index PoW on client startup | ||||||||||||||||||||||||||
static const bool DEFAULT_FULL_BLOCKINDEX_CHECK = false; | ||||||||||||||||||||||||||
//! If not doing full check of block index, check only N of the latest blocks | ||||||||||||||||||||||||||
static const int DEFAULT_BLOCKINDEX_NUMBER_OF_BLOCKS_TO_CHECK = 10000; | ||||||||||||||||||||||||||
Comment on lines
+46
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The introduction of
+ // Documentation for DEFAULT_FULL_BLOCKINDEX_CHECK
+ // Documentation for DEFAULT_BLOCKINDEX_NUMBER_OF_BLOCKS_TO_CHECK
+ // Consider making DEFAULT_BLOCKINDEX_NUMBER_OF_BLOCKS_TO_CHECK configurable
+ // Add validation for DEFAULT_BLOCKINDEX_NUMBER_OF_BLOCKS_TO_CHECK Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
struct CDiskTxPos : public CDiskBlockPos | ||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||
unsigned int nTxOffset; // after header | ||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modifications to
CBlockTreeDB::LoadBlockIndexGuts
introduce a conditional check for Proof of Work (PoW) based on the-fullblockindexcheck
flag and the number of most recent blocks. While this optimization aims to improve the initial block index loading speed, there are several areas that require attention:LoadBlockIndexGuts
increases the cognitive load for future maintainers. Consider refactoring to improve readability and maintainability. For example, extracting the logic for managinglastNBlocks
into separate functions could make the code more modular and easier to understand.