Skip to content

Commit fd80393

Browse files
committed
Squashed 'libbitcoinkernel-sys/bitcoin/' changes from b129d35f682..e70e527ef21
e70e527ef21 kernel: Add pure kernel bitcoin-chainstate ed9a8a54d3c kernel: Add block index utility functions to C header 6338dd45b55 kernel: Add function to read block undo data from disk to C header a2ac0c1e7c9 kernel: Add functions to read block from disk to C header 170060c3372 kernel: Add function for copying block data to C header 0f8c00bba07 kernel: Add functions for the block validation state to C header 41dba7d2603 kernel: Add validation interface to C header 877cf01f22c kernel: Add interrupt function to C header f77c2b90422 kernel: Add import blocks function to C header 254e17dbeab kernel: Add chainstate load options for in-memory dbs in C header 8baa06d318f kernel: Add options for reindexing in C header 0243ed8a200 kernel: Add block validation to C header 36fbab87e9e Kernel: Add chainstate loading to kernel C header b249e93f295 kernel: Add chainstate manager object to C header 2546745a393 kernel: Add notifications context option to C header 2578746e87f kerenl: Add chain params context option to C header REVERT: b129d35f682 kernel: Add pure kernel bitcoin-chainstate REVERT: c8aa86b12f7 kernel: Add block index utility functions to C header REVERT: 18fc20239ad kernel: Add function to read block undo data from disk to C header REVERT: 89444db9d50 kernel: Add functions to read block from disk to C header REVERT: 43212379420 kernel: Add function for copying block data to C header REVERT: 0ee2800a58d kernel: Add functions for the block validation state to C header REVERT: c7f7602f4cf kernel: Add validation interface to C header REVERT: 78bba95d191 kernel: Add interrupt function to C header REVERT: 069de41ca71 kernel: Add import blocks function to C header REVERT: bcc35724910 kernel: Add chainstate load options for in-memory dbs in C header REVERT: ed7c3c908bd kernel: Add options for reindexing in C header REVERT: e8b655fe109 kernel: Add block validation to C header REVERT: 5af1da3a09a Kernel: Add chainstate loading to kernel C header REVERT: 5174fa51f17 kernel: Add chainstate manager object to C header REVERT: 677128a9bce kernel: Add notifications context option to C header REVERT: 88fe3d49616 kerenl: Add chain params context option to C header git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: e70e527ef215197cac56b3f6e065abd891724c13
1 parent b8068f3 commit fd80393

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

src/kernel/bitcoinkernel.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,6 @@ std::shared_ptr<KernelValidationInterface>* cast_validation_interface(kernel_Val
383383
return reinterpret_cast<std::shared_ptr<KernelValidationInterface>*>(interface);
384384
}
385385

386-
std::function<void()>* cast_validation_event(kernel_ValidationEvent* event)
387-
{
388-
assert(event);
389-
return reinterpret_cast<std::function<void()>*>(event);
390-
}
391-
392386
const BlockValidationState* cast_block_validation_state(const kernel_BlockValidationState* block_validation_state)
393387
{
394388
assert(block_validation_state);
@@ -664,6 +658,7 @@ void kernel_context_options_set_notifications(kernel_ContextOptions* options_, c
664658
{
665659
auto options{cast_context_options(options_)};
666660
auto notifications{reinterpret_cast<const KernelNotifications*>(notifications_)};
661+
// Copy the notifications, so the caller can free it again
667662
options->m_notifications = std::make_unique<const KernelNotifications>(*notifications);
668663
}
669664

@@ -738,18 +733,6 @@ void kernel_validation_interface_destroy(kernel_ValidationInterface* validation_
738733
}
739734
}
740735

741-
void kernel_execute_event_and_destroy(kernel_ValidationEvent* event)
742-
{
743-
std::function<void()>* func = cast_validation_event(event);
744-
try {
745-
(*func)();
746-
delete func;
747-
} catch (const std::exception& e) {
748-
LogError("Failed to execute event: %s\n", std::string{e.what()});
749-
if (func) delete func;
750-
}
751-
}
752-
753736
kernel_ValidationMode kernel_get_validation_mode_from_block_validation_state(const kernel_BlockValidationState* block_validation_state_)
754737
{
755738
auto& block_validation_state = *cast_block_validation_state(block_validation_state_);

src/kernel/bitcoinkernel.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,6 @@ typedef struct kernel_Block kernel_Block;
212212
*/
213213
typedef struct kernel_BlockPointer kernel_BlockPointer;
214214

215-
/**
216-
* Opaque data structure for holding a validation event. The event can only be
217-
* processed by calling kernel_execute_event_and_destroy(..).
218-
*/
219-
typedef struct kernel_ValidationEvent kernel_ValidationEvent;
220-
221215
/**
222216
* Opaque data structure for holding the state of a block during validation.
223217
*
@@ -643,8 +637,8 @@ void kernel_notifications_destroy(const kernel_Notifications* notifications);
643637
kernel_ContextOptions* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_context_options_create();
644638

645639
/**
646-
* @brief Sets a single, specific field in the options. The option type has to
647-
* match the option value.
640+
* @brief Sets the chain params for the context options. The context created
641+
* with the options will be configured for these chain parameters.
648642
*
649643
* @param[in] context_options Non-null, previously created with kernel_context_options_create.
650644
* @param[in] chain_parameters Is set to the context options.
@@ -655,7 +649,8 @@ void kernel_context_options_set_chainparams(
655649
) BITCOINKERNEL_ARG_NONNULL(1) BITCOINKERNEL_ARG_NONNULL(2);
656650

657651
/**
658-
* @brief Set the kernel notifications for context option.
652+
* @brief Set the kernel notifications for the context options. The context
653+
* created with the options will be configured with these notifications.
659654
*
660655
* @param[in] context_options Non-null, previously created with kernel_context_options_create.
661656
* @param[in] notifications Is set to the context options.

0 commit comments

Comments
 (0)