mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-27 16:05:39 +01:00
kernel: Add import blocks function to C header
Add `btck_import_blocks` to import block data and rebuild indexes. The function can either reindex all existing block files if the indexes were previously wiped through the chainstate manager options, or import blocks from specified file paths.
This commit is contained in:
@@ -690,6 +690,20 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool ImportBlocks(const std::span<const std::string> paths)
|
||||
{
|
||||
std::vector<const char*> c_paths;
|
||||
std::vector<size_t> c_paths_lens;
|
||||
c_paths.reserve(paths.size());
|
||||
c_paths_lens.reserve(paths.size());
|
||||
for (const auto& path : paths) {
|
||||
c_paths.push_back(path.c_str());
|
||||
c_paths_lens.push_back(path.length());
|
||||
}
|
||||
|
||||
return btck_chainstate_manager_import_blocks(get(), c_paths.data(), c_paths_lens.data(), c_paths.size()) == 0;
|
||||
}
|
||||
|
||||
bool ProcessBlock(const Block& block, bool* new_block)
|
||||
{
|
||||
int _new_block;
|
||||
|
||||
Reference in New Issue
Block a user