diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-07-26 23:43:01 +0300 |
---|---|---|
committer | Larry Ruane <larryruane@gmail.com> | 2022-07-18 12:06:14 -0600 |
commit | dd065dae9fcebd6806ff67703ffa8128e80b97cc (patch) | |
tree | f747322a5ac69c6c4c98b142632e302938c71227 /src/node/blockstorage.cpp | |
parent | f002f8a0e76bd5abd60ef6809b1ff2b4c2d56071 (diff) |
refactor: Make mapBlocksUnknownParent local, and rename it
Co-authored-by: Larry Ruane <larryruane@gmail.com>
Diffstat (limited to 'src/node/blockstorage.cpp')
-rw-r--r-- | src/node/blockstorage.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 103f4f0d7f..06f6266ff9 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -21,6 +21,7 @@ #include <util/system.h> #include <validation.h> +#include <map> #include <unordered_map> namespace node { @@ -834,6 +835,9 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile // -reindex if (fReindex) { int nFile = 0; + // Map of disk positions for blocks with unknown parent (only used for reindex); + // parent hash -> child disk position, multiple children can have the same parent. + std::multimap<uint256, FlatFilePos> blocks_with_unknown_parent; while (true) { FlatFilePos pos(nFile, 0); if (!fs::exists(GetBlockPosFilename(pos))) { @@ -844,7 +848,7 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile break; // This error is logged in OpenBlockFile } LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile); - chainman.ActiveChainstate().LoadExternalBlockFile(file, &pos); + chainman.ActiveChainstate().LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent); if (ShutdownRequested()) { LogPrintf("Shutdown requested. Exit %s\n", __func__); return; |