mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 09:55:49 +02:00
kernel: Add Handle/View pattern for BlockValidationState
Add C API functions for managing BlockValidationState lifecycle: - btck_block_validation_state_create() - btck_block_validation_state_copy() - btck_block_validation_state_destroy() Introduce BlockValidationStateApi<> template to share common getter methods between BlockValidationState (Handle) and BlockValidationStateView (View) classes in the C++ wrapper. This enables external code to create and own BlockValidationState objects needed for the new process_block_header() API. Co-authored-by: TheCharlatan <seb.kung@gmail.com>
This commit is contained in:
@@ -885,6 +885,21 @@ const btck_BlockTreeEntry* btck_block_tree_entry_get_previous(const btck_BlockTr
|
||||
return btck_BlockTreeEntry::ref(btck_BlockTreeEntry::get(entry).pprev);
|
||||
}
|
||||
|
||||
btck_BlockValidationState* btck_block_validation_state_create()
|
||||
{
|
||||
return btck_BlockValidationState::create();
|
||||
}
|
||||
|
||||
btck_BlockValidationState* btck_block_validation_state_copy(const btck_BlockValidationState* state)
|
||||
{
|
||||
return btck_BlockValidationState::copy(state);
|
||||
}
|
||||
|
||||
void btck_block_validation_state_destroy(btck_BlockValidationState* state)
|
||||
{
|
||||
delete state;
|
||||
}
|
||||
|
||||
btck_ValidationMode btck_block_validation_state_get_validation_mode(const btck_BlockValidationState* block_validation_state_)
|
||||
{
|
||||
auto& block_validation_state = btck_BlockValidationState::get(block_validation_state_);
|
||||
|
||||
Reference in New Issue
Block a user