Skip to content

Commit b314fdd

Browse files
committed
Squashed 'libbitcoinkernel-sys/bitcoin/' changes from 26042c71846..f1b3ab751bf
f1b3ab751bf kernel: Add pure kernel bitcoin-chainstate 47c0497f899 kernel: Add functions to get the block hash from a block bf051407293 kernel: Add block index utility functions to C header 0dc1261a394 kernel: Add function to read block undo data from disk to C header 8ae118d85d9 kernel: Add functions to read block from disk to C header d757da1e777 kernel: Add function for copying block data to C header c7625645ffa kernel: Add functions for the block validation state to C header 085ab7e71c2 kernel: Add validation interface to C header d8b7cf099d3 kernel: Add interrupt function to C header 018613752ad kernel: Add import blocks function to C header 8fc00b9fcac kernel: Add chainstate load options for in-memory dbs in C header a9bb48476ed kernel: Add options for reindexing in C header 94bd5138dac kernel: Add block validation to C header c399b61f226 Kernel: Add chainstate loading to kernel C header feede0a425b kernel: Add chainstate manager option for setting worker threads REVERT: 26042c71846 kernel: Add pure kernel bitcoin-chainstate REVERT: bdc4e56deac kernel: Add functions to get the block hash from a block REVERT: bf80d2f5009 kernel: Add block index utility functions to C header REVERT: a6ab5345e3b kernel: Add function to read block undo data from disk to C header REVERT: 845b824d6c7 kernel: Add functions to read block from disk to C header REVERT: 9324c8c4f67 kernel: Add function for copying block data to C header REVERT: 368fc93fd80 kernel: Add functions for the block validation state to C header REVERT: eb6e25ac007 kernel: Add validation interface to C header REVERT: cdce4484005 kernel: Add interrupt function to C header REVERT: 7e47ec78768 kernel: Add import blocks function to C header REVERT: 2b803d50747 kernel: Add chainstate load options for in-memory dbs in C header REVERT: ea92eb13c4a kernel: Add options for reindexing in C header REVERT: 8254f2035a7 kernel: Add block validation to C header REVERT: ad7b880346e Kernel: Add chainstate loading to kernel C header git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: f1b3ab751bfe374095427796af00f6fdd50ec3e5
1 parent e5e72a4 commit b314fdd

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

src/kernel/bitcoin-chainstate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ int main(int argc, char* argv[])
159159

160160
ChainstateManagerOptions chainman_opts{context, abs_datadir};
161161
assert(chainman_opts);
162+
chainman_opts.SetWorkerThreads(4);
162163
BlockManagerOptions blockman_opts{context, abs_datadir / "blocks"};
163164
assert(blockman_opts);
164165

src/kernel/bitcoinkernel.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,12 @@ kernel_ChainstateManagerOptions* kernel_chainstate_manager_options_create(const
743743
}
744744
}
745745

746+
void kernel_chainstate_manager_options_set_worker_threads_num(kernel_ChainstateManagerOptions* opts_, int worker_threads)
747+
{
748+
auto opts{cast_chainstate_manager_options(opts_)};
749+
opts->worker_threads_num = worker_threads;
750+
}
751+
746752
void kernel_chainstate_manager_options_destroy(kernel_ChainstateManagerOptions* options)
747753
{
748754
if (options) {

src/kernel/bitcoinkernel.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,18 @@ kernel_BlockManagerOptions* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_block_manage
705705
const char* blocks_directory
706706
) BITCOINKERNEL_ARG_NONNULL(1) BITCOINKERNEL_ARG_NONNULL(2);
707707

708+
/**
709+
* @brief Set the number of available worker threads used during validation.
710+
*
711+
* @param[in] chainstate_manager_options Non-null, options to be set.
712+
* @param[in] worker_threads The number of worker threads that should be spawned in the thread pool
713+
* used for validation. The number should be greater than 0.
714+
*/
715+
void kernel_chainstate_manager_options_set_worker_threads_num(
716+
kernel_ChainstateManagerOptions* chainstate_manager_options,
717+
int worker_threads
718+
) BITCOINKERNEL_ARG_NONNULL(1);
719+
708720
/**
709721
* Destroy the block manager options.
710722
*/

src/kernel/bitcoinkernel_wrapper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,11 @@ class ChainstateManagerOptions
406406
{
407407
}
408408

409+
void SetWorkerThreads(int worker_threads) const noexcept
410+
{
411+
kernel_chainstate_manager_options_set_worker_threads_num(m_options.get(), worker_threads);
412+
}
413+
409414
/** Check whether this ChainstateManagerOptions object is valid. */
410415
explicit operator bool() const noexcept { return bool{m_options}; }
411416

src/test/kernel/test_kernel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ void chainman_test()
379379

380380
ChainstateManagerOptions chainman_opts{context, test_directory.m_directory};
381381
assert(chainman_opts);
382+
chainman_opts.SetWorkerThreads(4);
382383
BlockManagerOptions blockman_opts{context, test_directory.m_directory / "blocks"};
383384
assert(blockman_opts);
384385

0 commit comments

Comments
 (0)