Skip to content

Commit

Permalink
Squashed 'libbitcoinkernel-sys/bitcoin/' changes from b129d35f682..e7…
Browse files Browse the repository at this point in the history
…0e527ef21

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
  • Loading branch information
TheCharlatan committed Oct 11, 2024
1 parent b8068f3 commit fd80393
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
19 changes: 1 addition & 18 deletions src/kernel/bitcoinkernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,6 @@ std::shared_ptr<KernelValidationInterface>* cast_validation_interface(kernel_Val
return reinterpret_cast<std::shared_ptr<KernelValidationInterface>*>(interface);
}

std::function<void()>* cast_validation_event(kernel_ValidationEvent* event)
{
assert(event);
return reinterpret_cast<std::function<void()>*>(event);
}

const BlockValidationState* cast_block_validation_state(const kernel_BlockValidationState* block_validation_state)
{
assert(block_validation_state);
Expand Down Expand Up @@ -664,6 +658,7 @@ void kernel_context_options_set_notifications(kernel_ContextOptions* options_, c
{
auto options{cast_context_options(options_)};
auto notifications{reinterpret_cast<const KernelNotifications*>(notifications_)};
// Copy the notifications, so the caller can free it again
options->m_notifications = std::make_unique<const KernelNotifications>(*notifications);
}

Expand Down Expand Up @@ -738,18 +733,6 @@ void kernel_validation_interface_destroy(kernel_ValidationInterface* validation_
}
}

void kernel_execute_event_and_destroy(kernel_ValidationEvent* event)
{
std::function<void()>* func = cast_validation_event(event);
try {
(*func)();
delete func;
} catch (const std::exception& e) {
LogError("Failed to execute event: %s\n", std::string{e.what()});
if (func) delete func;
}
}

kernel_ValidationMode kernel_get_validation_mode_from_block_validation_state(const kernel_BlockValidationState* block_validation_state_)
{
auto& block_validation_state = *cast_block_validation_state(block_validation_state_);
Expand Down
13 changes: 4 additions & 9 deletions src/kernel/bitcoinkernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ typedef struct kernel_Block kernel_Block;
*/
typedef struct kernel_BlockPointer kernel_BlockPointer;

/**
* Opaque data structure for holding a validation event. The event can only be
* processed by calling kernel_execute_event_and_destroy(..).
*/
typedef struct kernel_ValidationEvent kernel_ValidationEvent;

/**
* Opaque data structure for holding the state of a block during validation.
*
Expand Down Expand Up @@ -643,8 +637,8 @@ void kernel_notifications_destroy(const kernel_Notifications* notifications);
kernel_ContextOptions* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_context_options_create();

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

/**
* @brief Set the kernel notifications for context option.
* @brief Set the kernel notifications for the context options. The context
* created with the options will be configured with these notifications.
*
* @param[in] context_options Non-null, previously created with kernel_context_options_create.
* @param[in] notifications Is set to the context options.
Expand Down

0 comments on commit fd80393

Please sign in to comment.