From a2955f09792b6232f3a45aa44a498b466279a8b7 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Fri, 30 Aug 2024 10:16:29 +0200 Subject: [PATCH] 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. --- src/node/blockstorage.cpp | 4 ++-- src/node/blockstorage.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 96cf69927c355..1fa657545a598 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -1210,7 +1210,7 @@ class ImportingNow } }; -void ImportBlocks(ChainstateManager& chainman, std::vector vImportFiles) +void ImportBlocks(ChainstateManager& chainman, std::span import_paths) { ImportingNow imp{chainman.m_blockman.m_importing}; @@ -1245,7 +1245,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector vImportFile } // -loadblock= - for (const fs::path& path : vImportFiles) { + for (const fs::path& path : import_paths) { AutoFile file{fsbridge::fopen(path, "rb")}; if (!file.IsNull()) { LogPrintf("Importing blocks file %s...\n", fs::PathToString(path)); diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h index 821bbf5109b2d..03bc5f4600720 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -429,7 +430,7 @@ class BlockManager void CleanupBlockRevFiles() const; }; -void ImportBlocks(ChainstateManager& chainman, std::vector vImportFiles); +void ImportBlocks(ChainstateManager& chainman, std::span import_paths); } // namespace node #endif // BITCOIN_NODE_BLOCKSTORAGE_H