Skip to content

Commit a2955f0

Browse files
committed
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.
1 parent 20515ea commit a2955f0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/node/blockstorage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ class ImportingNow
12101210
}
12111211
};
12121212

1213-
void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFiles)
1213+
void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_paths)
12141214
{
12151215
ImportingNow imp{chainman.m_blockman.m_importing};
12161216

@@ -1245,7 +1245,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
12451245
}
12461246

12471247
// -loadblock=
1248-
for (const fs::path& path : vImportFiles) {
1248+
for (const fs::path& path : import_paths) {
12491249
AutoFile file{fsbridge::fopen(path, "rb")};
12501250
if (!file.IsNull()) {
12511251
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));

src/node/blockstorage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <memory>
3030
#include <optional>
3131
#include <set>
32+
#include <span>
3233
#include <string>
3334
#include <unordered_map>
3435
#include <utility>
@@ -429,7 +430,7 @@ class BlockManager
429430
void CleanupBlockRevFiles() const;
430431
};
431432

432-
void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFiles);
433+
void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_paths);
433434
} // namespace node
434435

435436
#endif // BITCOIN_NODE_BLOCKSTORAGE_H

0 commit comments

Comments
 (0)