Bitcoin Kernel
C header for interacting with the Bitcoin Kernel library.
Loading...
Searching...
No Matches
bitcoinkernel.h
Go to the documentation of this file.
1// Copyright (c) 2024-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_KERNEL_BITCOINKERNEL_H
6#define BITCOIN_KERNEL_BITCOINKERNEL_H
7
8#ifndef __cplusplus
9#include <stdbool.h>
10#include <stddef.h>
11#include <stdint.h>
12#else
13#include <cstddef>
14#include <cstdint>
15#endif // __cplusplus
16
17#ifndef BITCOINKERNEL_API
18 #ifdef BITCOINKERNEL_BUILD
19 #if defined(_WIN32)
20 #define BITCOINKERNEL_API __declspec(dllexport)
21 #elif !defined(_WIN32) && defined(__GNUC__)
22 #define BITCOINKERNEL_API __attribute__((visibility("default")))
23 #else
24 #define BITCOINKERNEL_API
25 #endif
26 #else
27 #if defined(_WIN32) && !defined(BITCOINKERNEL_STATIC)
28 #define BITCOINKERNEL_API __declspec(dllimport)
29 #else
30 #define BITCOINKERNEL_API
31 #endif
32 #endif
33#endif
34
35/* Warning attributes */
36#if defined(__GNUC__)
37 #define BITCOINKERNEL_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
38#else
39 #define BITCOINKERNEL_WARN_UNUSED_RESULT
40#endif
41#if !defined(BITCOINKERNEL_BUILD) && defined(__GNUC__)
42 #define BITCOINKERNEL_ARG_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
43#else
44 #define BITCOINKERNEL_ARG_NONNULL(...)
45#endif
46
47#ifdef __cplusplus
48extern "C" {
49#endif // __cplusplus
50
110
115
120
133
142
153
169
178
187
201
206
212
220
232
239
245
252typedef void (*kernel_LogCallback)(void* user_data, const char* message, size_t message_len);
253
257typedef void (*kernel_NotifyBlockTip)(void* user_data, kernel_SynchronizationState state, const kernel_BlockIndex* index, double verification_progress);
258typedef void (*kernel_NotifyHeaderTip)(void* user_data, kernel_SynchronizationState state, int64_t height, int64_t timestamp, bool presync);
259typedef void (*kernel_NotifyProgress)(void* user_data, const char* title, size_t title_len, int progress_percent, bool resume_possible);
260typedef void (*kernel_NotifyWarningSet)(void* user_data, kernel_Warning warning, const char* message, size_t message_len);
261typedef void (*kernel_NotifyWarningUnset)(void* user_data, kernel_Warning warning);
262typedef void (*kernel_NotifyFlushError)(void* user_data, const char* message, size_t message_len);
263typedef void (*kernel_NotifyFatalError)(void* user_data, const char* message, size_t message_len);
264
268typedef void (*kernel_ValidationInterfaceBlockChecked)(void* user_data, const kernel_BlockPointer* block, const kernel_BlockValidationState* state);
269
279
294
307
326
343
352
363
375
398
409
413typedef struct {
414 unsigned char hash[32];
416
420typedef struct {
421 unsigned char* data;
422 size_t size;
424
429
438 const unsigned char* raw_transaction, size_t raw_transaction_len
440
445
447
452
460 const unsigned char* script_pubkey, size_t script_pubkey_len
462
469 const kernel_ScriptPubkey* script_pubkey
471
476
478
483
491 const kernel_ScriptPubkey* script_pubkey,
492 int64_t amount
494
504
513
518
520
525
547 const kernel_ScriptPubkey* script_pubkey,
548 int64_t amount,
549 const kernel_Transaction* tx_to,
550 const kernel_TransactionOutput** spent_outputs, size_t spent_outputs_len,
551 unsigned int input_index,
552 unsigned int flags,
555
557
562
571
586
596
606
619 kernel_LogCallback callback,
620 const void* user_data,
621 const kernel_LoggingOptions options
623
628
630
635
644 const kernel_ChainType chain_type);
645
650
652
657
662
671 kernel_ContextOptions* context_options,
672 const kernel_ChainParameters* chain_parameters
674
683 kernel_ContextOptions* context_options,
686
698 kernel_ContextOptions* context_options,
699 kernel_ValidationInterfaceCallbacks validation_interface_callbacks
701
706
708
713
724 const kernel_ContextOptions* context_options);
725
734 kernel_Context* context
736
741
743
748
762 const kernel_Context* context,
763 const char* data_directory,
764 size_t data_directory_len,
765 const char* blocks_directory,
766 size_t blocks_directory_len
768
778 kernel_ChainstateManagerOptions* chainstate_manager_options,
779 int worker_threads
781
793 kernel_ChainstateManagerOptions* chainstate_manager_options,
794 bool wipe_block_tree_db,
795 bool wipe_chainstate_db
797
805 kernel_ChainstateManagerOptions* chainstate_manager_options,
806 bool block_tree_db_in_memory
808
816 kernel_ChainstateManagerOptions* chainstate_manager_options,
817 bool chainstate_db_in_memory
819
824
826
831
845 const kernel_Context* context,
846 const kernel_ChainstateManagerOptions* chainstate_manager_options
848
862 kernel_ChainstateManager* chainstate_manager,
863 const char** block_file_paths, size_t* block_file_paths_lens, size_t block_file_paths_len
865
880 const kernel_Context* context,
881 kernel_ChainstateManager* chainstate_manager,
882 kernel_Block* block,
883 bool* new_block
885
890
892
897
908 const kernel_Context* context,
909 kernel_ChainstateManager* chainstate_manager,
910 const kernel_BlockIndex* block_index
912
921 const unsigned char* raw_block, size_t raw_block_len
923
931 kernel_Block* block
933
941 const kernel_BlockPointer* block
943
951 kernel_Block* block
953
961 const kernel_BlockPointer* block
963
968
970
975
980
982
987
992 const kernel_BlockValidationState* block_validation_state
994
999 const kernel_BlockValidationState* block_validation_state
1001
1003
1008
1018 const kernel_Context* context,
1019 kernel_ChainstateManager* chainstate_manager
1021
1030 const kernel_Context* context,
1031 kernel_ChainstateManager* chainstate_manager
1033
1044 const kernel_Context* context,
1045 kernel_ChainstateManager* chainstate_manager,
1046 kernel_BlockHash* block_hash
1047) BITCOINKERNEL_ARG_NONNULL(1, 2, 3);
1048
1060 const kernel_Context* context,
1061 kernel_ChainstateManager* chainstate_manager,
1062 int block_height
1064
1077 const kernel_Context* context,
1078 kernel_ChainstateManager* chainstate_manager,
1079 const kernel_BlockIndex* block_index
1080) BITCOINKERNEL_ARG_NONNULL(1, 2, 3);
1081
1090 const kernel_BlockIndex* block_index
1092
1100 const kernel_BlockIndex* block_index
1102
1103
1108
1110
1115
1126 const kernel_Context* context,
1127 kernel_ChainstateManager* chainstate_manager,
1128 const kernel_BlockIndex* block_index
1129) BITCOINKERNEL_ARG_NONNULL(1, 2, 3);
1130
1139 const kernel_BlockUndo* block_undo
1141
1152 const kernel_BlockUndo* block_undo,
1153 uint64_t transaction_undo_index
1155
1168 const kernel_BlockUndo* block_undo,
1169 uint64_t transaction_undo_index,
1170 uint64_t output_index
1172
1185 const kernel_BlockUndo* block_undo,
1186 uint64_t transaction_undo_index,
1187 uint64_t output_index
1189
1194
1196
1201
1209 const kernel_BlockIndex* block_index
1211
1216
1218
1219#ifdef __cplusplus
1220} // extern "C"
1221#endif // __cplusplus
1222
1223#endif // BITCOIN_KERNEL_BITCOINKERNEL_H
void(* kernel_NotifyWarningUnset)(void *user_data, kernel_Warning warning)
Definition bitcoinkernel.h:261
#define BITCOINKERNEL_API
Definition bitcoinkernel.h:30
BITCOINKERNEL_API kernel_BlockIndex BITCOINKERNEL_API kernel_BlockIndex * kernel_block_index_get_previous(const kernel_BlockIndex *block_index)
Returns the previous block index in the chain, or null if the current block index entry is the genesi...
BITCOINKERNEL_API kernel_BlockIndex * kernel_block_index_get_by_hash(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, kernel_BlockHash *block_hash) 2
Retrieve a block index by its block hash.
struct kernel_LoggingConnection kernel_LoggingConnection
Definition bitcoinkernel.h:132
BITCOINKERNEL_API void kernel_context_options_set_validation_interface(kernel_ContextOptions *context_options, kernel_ValidationInterfaceCallbacks validation_interface_callbacks)
Set the validation interface callbacks for the context options. The context created with the options ...
BITCOINKERNEL_API void kernel_block_hash_destroy(kernel_BlockHash *block_hash)
BITCOINKERNEL_API kernel_TransactionOutput * kernel_transaction_output_create(const kernel_ScriptPubkey *script_pubkey, int64_t amount)
Create a transaction output from a script pubkey and an amount.
void(* kernel_NotifyWarningSet)(void *user_data, kernel_Warning warning, const char *message, size_t message_len)
Definition bitcoinkernel.h:260
BITCOINKERNEL_API kernel_BlockIndex BITCOINKERNEL_API kernel_BlockIndex * kernel_block_index_get_by_height(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, int block_height) 2)
Retrieve a block index by its height in the currently active chain. Once retrieved there is no guaran...
struct kernel_Block kernel_Block
Definition bitcoinkernel.h:205
BITCOINKERNEL_API bool kernel_chainstate_manager_process_block(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, kernel_Block *block, bool *new_block) 2
Process and validate the passed in block with the chainstate manager. More detailed validation inform...
struct kernel_ContextOptions kernel_ContextOptions
Definition bitcoinkernel.h:152
void(* kernel_NotifyHeaderTip)(void *user_data, kernel_SynchronizationState state, int64_t height, int64_t timestamp, bool presync)
Definition bitcoinkernel.h:258
BITCOINKERNEL_API void kernel_logging_enable_category(const kernel_LogCategory category)
Enable a specific log category for the global internal logger. This function is not thread safe....
kernel_ScriptFlags
Definition bitcoinkernel.h:380
@ kernel_SCRIPT_FLAGS_VERIFY_WITNESS
enable WITNESS (BIP141)
Definition bitcoinkernel.h:387
@ kernel_SCRIPT_FLAGS_VERIFY_ALL
Definition bitcoinkernel.h:390
@ kernel_SCRIPT_FLAGS_VERIFY_NULLDUMMY
enforce NULLDUMMY (BIP147)
Definition bitcoinkernel.h:384
@ kernel_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY
enable CHECKSEQUENCEVERIFY (BIP112)
Definition bitcoinkernel.h:386
@ kernel_SCRIPT_FLAGS_VERIFY_DERSIG
enforce strict DER (BIP66) compliance
Definition bitcoinkernel.h:383
@ kernel_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY
enable CHECKLOCKTIMEVERIFY (BIP65)
Definition bitcoinkernel.h:385
@ kernel_SCRIPT_FLAGS_VERIFY_NONE
Definition bitcoinkernel.h:381
@ kernel_SCRIPT_FLAGS_VERIFY_P2SH
evaluate P2SH (BIP16) subscripts
Definition bitcoinkernel.h:382
@ kernel_SCRIPT_FLAGS_VERIFY_TAPROOT
enable TAPROOT (BIPs 341 & 342)
Definition bitcoinkernel.h:389
#define BITCOINKERNEL_WARN_UNUSED_RESULT
Definition bitcoinkernel.h:39
BITCOINKERNEL_API int32_t kernel_block_index_get_height(const kernel_BlockIndex *block_index)
Return the height of a certain block index.
BITCOINKERNEL_API void kernel_chainstate_manager_options_set_block_tree_db_in_memory(kernel_ChainstateManagerOptions *chainstate_manager_options, bool block_tree_db_in_memory)
Sets block tree db in memory in the options.
kernel_SynchronizationState
Definition bitcoinkernel.h:234
@ kernel_INIT_DOWNLOAD
Definition bitcoinkernel.h:236
@ kernel_POST_INIT
Definition bitcoinkernel.h:237
@ kernel_INIT_REINDEX
Definition bitcoinkernel.h:235
kernel_ValidationMode
Definition bitcoinkernel.h:274
@ kernel_VALIDATION_STATE_INVALID
Definition bitcoinkernel.h:276
@ kernel_VALIDATION_STATE_ERROR
Definition bitcoinkernel.h:277
@ kernel_VALIDATION_STATE_VALID
Definition bitcoinkernel.h:275
void(* kernel_NotifyBlockTip)(void *user_data, kernel_SynchronizationState state, const kernel_BlockIndex *index, double verification_progress)
Definition bitcoinkernel.h:257
void(* kernel_LogCallback)(void *user_data, const char *message, size_t message_len)
Definition bitcoinkernel.h:252
BITCOINKERNEL_API bool kernel_verify_script(const kernel_ScriptPubkey *script_pubkey, int64_t amount, const kernel_Transaction *tx_to, const kernel_TransactionOutput **spent_outputs, size_t spent_outputs_len, unsigned int input_index, unsigned int flags, kernel_ScriptVerifyStatus *status) 3)
Verify if the input at input_index of tx_to spends the script pubkey under the constraints specified ...
kernel_ChainType
Definition bitcoinkernel.h:402
@ kernel_CHAIN_TYPE_REGTEST
Definition bitcoinkernel.h:407
@ kernel_CHAIN_TYPE_TESTNET_4
Definition bitcoinkernel.h:405
@ kernel_CHAIN_TYPE_MAINNET
Definition bitcoinkernel.h:403
@ kernel_CHAIN_TYPE_SIGNET
Definition bitcoinkernel.h:406
@ kernel_CHAIN_TYPE_TESTNET
Definition bitcoinkernel.h:404
BITCOINKERNEL_API void kernel_transaction_destroy(kernel_Transaction *transaction)
BITCOINKERNEL_API kernel_ChainParameters * kernel_chain_parameters_create(const kernel_ChainType chain_type)
Creates a chain parameters struct with default parameters based on the passed in chain type.
struct kernel_ChainParameters kernel_ChainParameters
Definition bitcoinkernel.h:141
struct kernel_BlockValidationState kernel_BlockValidationState
Definition bitcoinkernel.h:219
void(* kernel_ValidationInterfaceBlockChecked)(void *user_data, const kernel_BlockPointer *block, const kernel_BlockValidationState *state)
Definition bitcoinkernel.h:268
BITCOINKERNEL_API void kernel_logging_disable()
This disables the global internal logger. No log messages will be buffered internally anymore once th...
BITCOINKERNEL_API kernel_Context * kernel_context_create(const kernel_ContextOptions *context_options)
Create a new kernel context. If the options have not been previously set, their corresponding fields ...
BITCOINKERNEL_API kernel_Block BITCOINKERNEL_API kernel_Block * kernel_block_create(const unsigned char *raw_block, size_t raw_block_len)
Parse a serialized raw block into a new block object.
void(* kernel_NotifyProgress)(void *user_data, const char *title, size_t title_len, int progress_percent, bool resume_possible)
Definition bitcoinkernel.h:259
BITCOINKERNEL_API kernel_ChainstateManager * kernel_chainstate_manager_create(const kernel_Context *context, const kernel_ChainstateManagerOptions *chainstate_manager_options) 2)
Create a chainstate manager. This is the main object for many validation tasks as well as for retriev...
BITCOINKERNEL_API kernel_BlockHash * kernel_block_index_get_block_hash(const kernel_BlockIndex *block_index)
Return the block hash associated with a block index.
BITCOINKERNEL_API void kernel_context_options_destroy(kernel_ContextOptions *context_options)
BITCOINKERNEL_API void kernel_logging_connection_destroy(kernel_LoggingConnection *logging_connection)
BITCOINKERNEL_API kernel_ByteArray * kernel_block_pointer_copy_data(const kernel_BlockPointer *block)
Copies block data into the returned byte array.
BITCOINKERNEL_API kernel_BlockHash * kernel_block_pointer_get_hash(const kernel_BlockPointer *block)
Calculate and return the hash of a block.
BITCOINKERNEL_API kernel_BlockIndex * kernel_block_index_get_genesis(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager) 2)
Get the block index entry of the genesis block.
struct kernel_BlockUndo kernel_BlockUndo
Definition bitcoinkernel.h:231
void(* kernel_NotifyFlushError)(void *user_data, const char *message, size_t message_len)
Definition bitcoinkernel.h:262
BITCOINKERNEL_API void kernel_chain_parameters_destroy(kernel_ChainParameters *chain_parameters)
struct kernel_TransactionOutput kernel_TransactionOutput
Definition bitcoinkernel.h:119
#define BITCOINKERNEL_ARG_NONNULL(...)
Definition bitcoinkernel.h:44
BITCOINKERNEL_API kernel_LoggingConnection * kernel_logging_connection_create(kernel_LogCallback callback, const void *user_data, const kernel_LoggingOptions options)
Start logging messages through the provided callback. Log messages produced before this function is f...
struct kernel_Transaction kernel_Transaction
Definition bitcoinkernel.h:109
BITCOINKERNEL_API kernel_BlockIndex * kernel_block_index_get_tip(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager) 2)
Get the block index entry of the current chain tip. Once returned, there is no guarantee that it rema...
BITCOINKERNEL_API void kernel_block_destroy(kernel_Block *block)
BITCOINKERNEL_API void kernel_context_destroy(kernel_Context *context)
BITCOINKERNEL_API bool kernel_chainstate_manager_options_set_wipe_dbs(kernel_ChainstateManagerOptions *chainstate_manager_options, bool wipe_block_tree_db, bool wipe_chainstate_db)
Sets wipe db in the options. In combination with calling kernel_chainstate_manager_import_blocks this...
BITCOINKERNEL_API void kernel_context_options_set_chainparams(kernel_ContextOptions *context_options, const kernel_ChainParameters *chain_parameters) 2)
Sets the chain params for the context options. The context created with the options will be configure...
BITCOINKERNEL_API kernel_Block * kernel_block_read(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, const kernel_BlockIndex *block_index) 2
Reads the block the passed in block index points to from disk and returns it.
BITCOINKERNEL_API uint32_t kernel_block_undo_get_transaction_output_height_by_index(const kernel_BlockUndo *block_undo, uint64_t transaction_undo_index, uint64_t output_index)
Returns the block height of the block that contains the output at output_index within the transaction...
BITCOINKERNEL_API kernel_TransactionOutput * kernel_block_undo_copy_transaction_output_by_index(const kernel_BlockUndo *block_undo, uint64_t transaction_undo_index, uint64_t output_index)
Return a transaction output contained in the transaction undo data of a block undo data at a certain ...
BITCOINKERNEL_API void kernel_transaction_output_destroy(kernel_TransactionOutput *transaction_output)
BITCOINKERNEL_API void kernel_chainstate_manager_options_set_chainstate_db_in_memory(kernel_ChainstateManagerOptions *chainstate_manager_options, bool chainstate_db_in_memory)
Sets chainstate db in memory in the options.
BITCOINKERNEL_API void kernel_block_index_destroy(kernel_BlockIndex *block_index)
Destroy the block index.
kernel_BlockValidationResult
Definition bitcoinkernel.h:283
@ kernel_BLOCK_HEADER_LOW_WORK
the block header may be on a too-little-work chain
Definition bitcoinkernel.h:292
@ kernel_BLOCK_MUTATED
the block's data didn't match the data committed to by the PoW
Definition bitcoinkernel.h:288
@ kernel_BLOCK_CACHED_INVALID
this block was cached as being invalid and we didn't store the reason why
Definition bitcoinkernel.h:286
@ kernel_BLOCK_INVALID_HEADER
invalid proof of work or time too old
Definition bitcoinkernel.h:287
@ kernel_BLOCK_TIME_FUTURE
block timestamp was > 2 hours in the future (or our clock is bad)
Definition bitcoinkernel.h:291
@ kernel_BLOCK_RESULT_UNSET
initial value. Block has not yet been rejected
Definition bitcoinkernel.h:284
@ kernel_BLOCK_INVALID_PREV
A block this one builds on is invalid.
Definition bitcoinkernel.h:290
@ kernel_BLOCK_MISSING_PREV
We don't have the previous block the checked one is built on.
Definition bitcoinkernel.h:289
@ kernel_BLOCK_CONSENSUS
invalid by consensus rules (excluding any below reasons)
Definition bitcoinkernel.h:285
BITCOINKERNEL_API kernel_ValidationMode kernel_block_validation_state_get_validation_mode(const kernel_BlockValidationState *block_validation_state)
BITCOINKERNEL_API void kernel_chainstate_manager_options_destroy(kernel_ChainstateManagerOptions *chainstate_manager_options)
BITCOINKERNEL_API kernel_ChainstateManagerOptions * kernel_chainstate_manager_options_create(const kernel_Context *context, const char *data_directory, size_t data_directory_len, const char *blocks_directory, size_t blocks_directory_len) 2)
Create options for the chainstate manager.
BITCOINKERNEL_API void kernel_byte_array_destroy(kernel_ByteArray *byte_array)
BITCOINKERNEL_API kernel_ScriptPubkey * kernel_transaction_output_copy_script_pubkey(kernel_TransactionOutput *transaction_output)
Copies the script pubkey of an output in the returned script pubkey opaque object.
BITCOINKERNEL_API kernel_ByteArray * kernel_block_copy_data(kernel_Block *block)
Copies block data into the returned byte array.
BITCOINKERNEL_API kernel_BlockUndo * kernel_block_undo_read(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, const kernel_BlockIndex *block_index) 2
Reads the block undo data the passed in block index points to from disk and returns it.
BITCOINKERNEL_API kernel_ByteArray * kernel_script_pubkey_copy_data(const kernel_ScriptPubkey *script_pubkey)
Copies the script pubkey data into the returned byte array.
BITCOINKERNEL_API bool kernel_chainstate_manager_import_blocks(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, const char **block_file_paths, size_t *block_file_paths_lens, size_t block_file_paths_len) 2)
May be called once the kernel_ChainstateManager is instantiated. Triggers the start of a reindex if t...
struct kernel_BlockPointer kernel_BlockPointer
Definition bitcoinkernel.h:211
kernel_LogLevel
Definition bitcoinkernel.h:347
@ kernel_LOG_TRACE
Definition bitcoinkernel.h:348
@ kernel_LOG_DEBUG
Definition bitcoinkernel.h:349
@ kernel_LOG_INFO
Definition bitcoinkernel.h:350
BITCOINKERNEL_API kernel_BlockIndex * kernel_block_index_get_next(const kernel_Context *context, kernel_ChainstateManager *chainstate_manager, const kernel_BlockIndex *block_index) 2
Return the next block index in the currently active chain, or null if the current block index is the ...
BITCOINKERNEL_API kernel_Transaction * kernel_transaction_create(const unsigned char *raw_transaction, size_t raw_transaction_len)
Create a new transaction from the serialized data.
BITCOINKERNEL_API kernel_ContextOptions * kernel_context_options_create()
struct kernel_ScriptPubkey kernel_ScriptPubkey
Definition bitcoinkernel.h:114
kernel_Warning
Definition bitcoinkernel.h:241
@ kernel_LARGE_WORK_INVALID_CHAIN
Definition bitcoinkernel.h:243
@ kernel_UNKNOWN_NEW_RULES_ACTIVATED
Definition bitcoinkernel.h:242
void(* kernel_NotifyFatalError)(void *user_data, const char *message, size_t message_len)
Definition bitcoinkernel.h:263
BITCOINKERNEL_API kernel_BlockValidationResult kernel_block_validation_state_get_block_validation_result(const kernel_BlockValidationState *block_validation_state)
BITCOINKERNEL_API void kernel_script_pubkey_destroy(kernel_ScriptPubkey *script_pubkey)
struct kernel_ChainstateManager kernel_ChainstateManager
Definition bitcoinkernel.h:200
kernel_ScriptVerifyStatus
Definition bitcoinkernel.h:367
@ kernel_SCRIPT_VERIFY_ERROR_INVALID_FLAGS_COMBINATION
The flags very combined in an invalid way.
Definition bitcoinkernel.h:371
@ kernel_SCRIPT_VERIFY_ERROR_TX_INPUT_INDEX
The provided input index is out of range of the actual number of inputs of the transaction.
Definition bitcoinkernel.h:369
@ kernel_SCRIPT_VERIFY_OK
Definition bitcoinkernel.h:368
@ kernel_SCRIPT_VERIFY_ERROR_INVALID_FLAGS
The provided bitfield for the flags was invalid.
Definition bitcoinkernel.h:370
@ kernel_SCRIPT_VERIFY_ERROR_SPENT_OUTPUTS_REQUIRED
The taproot flag was set, so valid spent_outputs have to be provided.
Definition bitcoinkernel.h:372
@ kernel_SCRIPT_VERIFY_ERROR_SPENT_OUTPUTS_MISMATCH
The number of spent outputs does not match the number of inputs of the tx.
Definition bitcoinkernel.h:373
BITCOINKERNEL_API void kernel_logging_disable_category(const kernel_LogCategory category)
Disable a specific log category for the global internal logger. This function is not thread safe....
BITCOINKERNEL_API int64_t kernel_transaction_output_get_amount(kernel_TransactionOutput *transaction_output)
Gets the amount associated with this transaction output.
struct kernel_BlockIndex kernel_BlockIndex
Definition bitcoinkernel.h:177
BITCOINKERNEL_API void kernel_logging_set_level_category(const kernel_LogCategory category, kernel_LogLevel level)
Set the log level of the global internal logger. This does not enable the selected categories....
BITCOINKERNEL_API bool kernel_context_interrupt(kernel_Context *context)
Interrupt can be used to halt long-running validation functions like when reindexing,...
BITCOINKERNEL_API kernel_BlockUndo BITCOINKERNEL_API uint64_t kernel_block_undo_size(const kernel_BlockUndo *block_undo)
Returns the number of transactions whose undo data is contained in block undo.
BITCOINKERNEL_API kernel_ScriptPubkey * kernel_script_pubkey_create(const unsigned char *script_pubkey, size_t script_pubkey_len)
Create a script pubkey from serialized data.
BITCOINKERNEL_API void kernel_context_options_set_notifications(kernel_ContextOptions *context_options, kernel_NotificationInterfaceCallbacks notifications)
Set the kernel notifications for the context options. The context created with the options will be co...
BITCOINKERNEL_API void kernel_block_undo_destroy(kernel_BlockUndo *block_undo)
BITCOINKERNEL_API uint64_t kernel_block_undo_get_transaction_undo_size(const kernel_BlockUndo *block_undo, uint64_t transaction_undo_index)
Returns the number of previous transaction outputs contained in the transaction undo data.
struct kernel_ChainstateManagerOptions kernel_ChainstateManagerOptions
Definition bitcoinkernel.h:186
BITCOINKERNEL_API kernel_BlockHash * kernel_block_get_hash(kernel_Block *block)
Calculate and return the hash of a block.
struct kernel_Context kernel_Context
Definition bitcoinkernel.h:168
BITCOINKERNEL_API bool BITCOINKERNEL_API void kernel_chainstate_manager_destroy(kernel_ChainstateManager *chainstate_manager, const kernel_Context *context)
BITCOINKERNEL_API void kernel_chainstate_manager_options_set_worker_threads_num(kernel_ChainstateManagerOptions *chainstate_manager_options, int worker_threads)
Set the number of available worker threads used during validation.
kernel_LogCategory
Definition bitcoinkernel.h:330
@ kernel_LOG_KERNEL
Definition bitcoinkernel.h:341
@ kernel_LOG_VALIDATION
Definition bitcoinkernel.h:340
@ kernel_LOG_BENCH
Definition bitcoinkernel.h:332
@ kernel_LOG_LEVELDB
Definition bitcoinkernel.h:335
@ kernel_LOG_PRUNE
Definition bitcoinkernel.h:337
@ kernel_LOG_RAND
Definition bitcoinkernel.h:338
@ kernel_LOG_COINDB
Definition bitcoinkernel.h:334
@ kernel_LOG_BLOCKSTORAGE
Definition bitcoinkernel.h:333
@ kernel_LOG_MEMPOOL
Definition bitcoinkernel.h:336
@ kernel_LOG_ALL
Definition bitcoinkernel.h:331
@ kernel_LOG_REINDEX
Definition bitcoinkernel.h:339
Definition bitcoinkernel.h:413
Definition bitcoinkernel.h:420
unsigned char * data
Definition bitcoinkernel.h:421
size_t size
Definition bitcoinkernel.h:422
Definition bitcoinkernel.h:356
bool log_timestamps
Prepend a timestamp to log messages.
Definition bitcoinkernel.h:357
bool always_print_category_levels
Prepend the log category and level to log messages.
Definition bitcoinkernel.h:361
bool log_threadnames
Prepend the name of the thread to log messages.
Definition bitcoinkernel.h:359
bool log_sourcelocations
Prepend the source location to log messages.
Definition bitcoinkernel.h:360
bool log_time_micros
Log timestamps in microsecond precision.
Definition bitcoinkernel.h:358
Definition bitcoinkernel.h:316
kernel_NotifyProgress progress
Reports on current block synchronization progress.
Definition bitcoinkernel.h:320
kernel_NotifyFatalError fatal_error
A un-recoverable system error encountered by the library.
Definition bitcoinkernel.h:324
kernel_NotifyBlockTip block_tip
The chain's tip was updated to the provided block index.
Definition bitcoinkernel.h:318
kernel_NotifyWarningUnset warning_unset
A previous condition leading to the issuance of a warning is no longer given.
Definition bitcoinkernel.h:322
kernel_NotifyWarningSet warning_set
A warning issued by the kernel library during validation.
Definition bitcoinkernel.h:321
kernel_NotifyFlushError flush_error
An error encountered when flushing data to disk.
Definition bitcoinkernel.h:323
kernel_NotifyHeaderTip header_tip
A new best block header was added.
Definition bitcoinkernel.h:319
const void * user_data
Holds a user-defined opaque structure that is passed to the notification callbacks.
Definition bitcoinkernel.h:317
Definition bitcoinkernel.h:301
const void * user_data
Definition bitcoinkernel.h:302
kernel_ValidationInterfaceBlockChecked block_checked
Definition bitcoinkernel.h:304