Skip to content

Commit aed0056

Browse files
committed
Merge commit 'fd80393ab2cfbc7e1efb2fb65a0cfecae3ca3da8'
2 parents 8bcec68 + fd80393 commit aed0056

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

libbitcoinkernel-sys/bitcoin/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_);

libbitcoinkernel-sys/bitcoin/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)