mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
kernel: Add options for reindexing in C header
Adds options for wiping the chainstate and block tree indexes to the chainstate manager options. In combination and once the `*_import_blocks(...)` function is added in a later commit, this triggers a reindex. For now, it just wipes the existing data.
This commit is contained in:
@@ -706,6 +706,19 @@ void btck_chainstate_manager_options_destroy(btck_ChainstateManagerOptions* opti
|
||||
delete options;
|
||||
}
|
||||
|
||||
int btck_chainstate_manager_options_set_wipe_dbs(btck_ChainstateManagerOptions* chainman_opts, int wipe_block_tree_db, int wipe_chainstate_db)
|
||||
{
|
||||
if (wipe_block_tree_db == 1 && wipe_chainstate_db != 1) {
|
||||
LogError("Wiping the block tree db without also wiping the chainstate db is currently unsupported.");
|
||||
return -1;
|
||||
}
|
||||
auto& opts{btck_ChainstateManagerOptions::get(chainman_opts)};
|
||||
LOCK(opts.m_mutex);
|
||||
opts.m_blockman_options.block_tree_db_params.wipe_data = wipe_block_tree_db == 1;
|
||||
opts.m_chainstate_load_options.wipe_chainstate_db = wipe_chainstate_db == 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
btck_ChainstateManager* btck_chainstate_manager_create(
|
||||
const btck_ChainstateManagerOptions* chainman_opts)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user