mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
index: verify blocks data existence only once
At present, during init, we traverse the chain (once per index) to confirm that all necessary blocks to sync each index up to the current tip are present. To make the process more efficient, we can fetch the oldest block from the indexers and perform the chain data existence check from that point only once. This also moves the pruning violation check to the end of the 'loadinit' thread, which is where the reindex, block loading and chain activation processes happen. Making the node's startup process faster, allowing us to remove the global g_indexes_ready_to_sync flag, and enabling the execution of the pruning violation verification even when the reindex or reindex-chainstate flags are enabled (which has being skipped so far).
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
|
||||
namespace node {
|
||||
std::atomic_bool fReindex(false);
|
||||
std::atomic_bool g_indexes_ready_to_sync{false};
|
||||
|
||||
bool CBlockIndexWorkComparator::operator()(const CBlockIndex* pa, const CBlockIndex* pb) const
|
||||
{
|
||||
@@ -954,7 +953,5 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
|
||||
return;
|
||||
}
|
||||
} // End scope of ImportingNow
|
||||
|
||||
g_indexes_ready_to_sync = true;
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
@@ -50,7 +50,6 @@ static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
|
||||
static constexpr size_t BLOCK_SERIALIZATION_HEADER_SIZE = CMessageHeader::MESSAGE_START_SIZE + sizeof(unsigned int);
|
||||
|
||||
extern std::atomic_bool fReindex;
|
||||
extern std::atomic_bool g_indexes_ready_to_sync;
|
||||
|
||||
// Because validation code takes pointers to the map's CBlockIndex objects, if
|
||||
// we ever switch to another associative container, we need to either use a
|
||||
|
||||
Reference in New Issue
Block a user