mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
validation: Use span for ImportBlocks paths
Makes it friendlier for potential future users of the kernel library if they do not store the headers in a std::vector, but can guarantee contiguous memory.
This commit is contained in:
parent
20515ea3f5
commit
a2955f0979
2 changed files with 4 additions and 3 deletions
|
@ -1210,7 +1210,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFiles)
|
void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_paths)
|
||||||
{
|
{
|
||||||
ImportingNow imp{chainman.m_blockman.m_importing};
|
ImportingNow imp{chainman.m_blockman.m_importing};
|
||||||
|
|
||||||
|
@ -1245,7 +1245,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// -loadblock=
|
// -loadblock=
|
||||||
for (const fs::path& path : vImportFiles) {
|
for (const fs::path& path : import_paths) {
|
||||||
AutoFile file{fsbridge::fopen(path, "rb")};
|
AutoFile file{fsbridge::fopen(path, "rb")};
|
||||||
if (!file.IsNull()) {
|
if (!file.IsNull()) {
|
||||||
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));
|
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -429,7 +430,7 @@ public:
|
||||||
void CleanupBlockRevFiles() const;
|
void CleanupBlockRevFiles() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFiles);
|
void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_paths);
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
|
||||||
#endif // BITCOIN_NODE_BLOCKSTORAGE_H
|
#endif // BITCOIN_NODE_BLOCKSTORAGE_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue