![]() |
Bitcoin Core 30.99.0
P2P Digital Currency
|
#include <kernel/bitcoinkernel.h>#include <chain.h>#include <coins.h>#include <consensus/amount.h>#include <consensus/validation.h>#include <kernel/caches.h>#include <kernel/chainparams.h>#include <kernel/checks.h>#include <kernel/context.h>#include <kernel/cs_main.h>#include <kernel/notifications_interface.h>#include <kernel/warning.h>#include <logging.h>#include <node/blockstorage.h>#include <node/chainstate.h>#include <primitives/block.h>#include <primitives/transaction.h>#include <script/interpreter.h>#include <script/script.h>#include <serialize.h>#include <streams.h>#include <sync.h>#include <tinyformat.h>#include <uint256.h>#include <undo.h>#include <util/fs.h>#include <util/result.h>#include <util/signalinterrupt.h>#include <util/task_runner.h>#include <util/translation.h>#include <validation.h>#include <validationinterface.h>#include <cassert>#include <cstddef>#include <cstring>#include <exception>#include <functional>#include <list>#include <memory>#include <span>#include <string>#include <tuple>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | btck_BlockTreeEntry |
| struct | btck_Block |
| struct | btck_BlockValidationState |
| struct | btck_Transaction |
| struct | btck_TransactionOutput |
| struct | btck_ScriptPubkey |
| struct | btck_LoggingConnection |
| struct | btck_ContextOptions |
| struct | btck_Context |
| struct | btck_ChainParameters |
| struct | btck_ChainstateManagerOptions |
| struct | btck_ChainstateManager |
| struct | btck_Chain |
| struct | btck_BlockSpentOutputs |
| struct | btck_TransactionSpentOutputs |
| struct | btck_Coin |
| struct | btck_BlockHash |
| struct | btck_TransactionInput |
| struct | btck_TransactionOutPoint |
| struct | btck_Txid |
Macros | |
| #define | BITCOINKERNEL_BUILD |
Functions | |
| btck_Transaction * | btck_transaction_create (const void *raw_transaction, size_t raw_transaction_len) |
| Create a new transaction from the serialized data. More... | |
| size_t | btck_transaction_count_outputs (const btck_Transaction *transaction) |
| Get the number of outputs of a transaction. More... | |
| const btck_TransactionOutput * | btck_transaction_get_output_at (const btck_Transaction *transaction, size_t output_index) |
| Get the transaction outputs at the provided index. More... | |
| size_t | btck_transaction_count_inputs (const btck_Transaction *transaction) |
| Get the number of inputs of a transaction. More... | |
| const btck_TransactionInput * | btck_transaction_get_input_at (const btck_Transaction *transaction, size_t input_index) |
| Get the transaction input at the provided index. More... | |
| const btck_Txid * | btck_transaction_get_txid (const btck_Transaction *transaction) |
| Get the txid of a transaction. More... | |
| btck_Transaction * | btck_transaction_copy (const btck_Transaction *transaction) |
| Copy a transaction. More... | |
| int | btck_transaction_to_bytes (const btck_Transaction *transaction, btck_WriteBytes writer, void *user_data) |
| void | btck_transaction_destroy (btck_Transaction *transaction) |
| Destroy the transaction. More... | |
| btck_ScriptPubkey * | btck_script_pubkey_create (const void *script_pubkey, size_t script_pubkey_len) |
| Create a script pubkey from serialized data. More... | |
| int | btck_script_pubkey_to_bytes (const btck_ScriptPubkey *script_pubkey_, btck_WriteBytes writer, void *user_data) |
| btck_ScriptPubkey * | btck_script_pubkey_copy (const btck_ScriptPubkey *script_pubkey) |
| Copy a script pubkey. More... | |
| void | btck_script_pubkey_destroy (btck_ScriptPubkey *script_pubkey) |
| Destroy the script pubkey. More... | |
| btck_TransactionOutput * | btck_transaction_output_create (const btck_ScriptPubkey *script_pubkey, int64_t amount) |
| Create a transaction output from a script pubkey and an amount. More... | |
| btck_TransactionOutput * | btck_transaction_output_copy (const btck_TransactionOutput *output) |
| Copy a transaction output. More... | |
| const btck_ScriptPubkey * | btck_transaction_output_get_script_pubkey (const btck_TransactionOutput *output) |
| Get the script pubkey of the output. More... | |
| int64_t | btck_transaction_output_get_amount (const btck_TransactionOutput *output) |
| Get the amount in the output. More... | |
| void | btck_transaction_output_destroy (btck_TransactionOutput *output) |
| Destroy the transaction output. More... | |
| int | btck_script_pubkey_verify (const btck_ScriptPubkey *script_pubkey, const int64_t amount, const btck_Transaction *tx_to, const btck_TransactionOutput **spent_outputs_, size_t spent_outputs_len, const unsigned int input_index, const btck_ScriptVerificationFlags flags, btck_ScriptVerifyStatus *status) |
| btck_TransactionInput * | btck_transaction_input_copy (const btck_TransactionInput *input) |
| Copy a transaction input. More... | |
| const btck_TransactionOutPoint * | btck_transaction_input_get_out_point (const btck_TransactionInput *input) |
| Get the transaction out point. More... | |
| void | btck_transaction_input_destroy (btck_TransactionInput *input) |
| Destroy the transaction input. More... | |
| btck_TransactionOutPoint * | btck_transaction_out_point_copy (const btck_TransactionOutPoint *out_point) |
| Copy a transaction out point. More... | |
| uint32_t | btck_transaction_out_point_get_index (const btck_TransactionOutPoint *out_point) |
| Get the output position from the transaction out point. More... | |
| const btck_Txid * | btck_transaction_out_point_get_txid (const btck_TransactionOutPoint *out_point) |
| Get the txid from the transaction out point. More... | |
| void | btck_transaction_out_point_destroy (btck_TransactionOutPoint *out_point) |
| Destroy the transaction out point. More... | |
| btck_Txid * | btck_txid_copy (const btck_Txid *txid) |
| Copy a txid. More... | |
| void | btck_txid_to_bytes (const btck_Txid *txid, unsigned char output[32]) |
| int | btck_txid_equals (const btck_Txid *txid1, const btck_Txid *txid2) |
| void | btck_txid_destroy (btck_Txid *txid) |
| Destroy the txid. More... | |
| void | btck_logging_set_options (const btck_LoggingOptions options) |
| Set some options for the global internal logger. More... | |
| void | btck_logging_set_level_category (btck_LogCategory category, btck_LogLevel level) |
| Set the log level of the global internal logger. More... | |
| void | btck_logging_enable_category (btck_LogCategory category) |
| Enable a specific log category for the global internal logger. More... | |
| void | btck_logging_disable_category (btck_LogCategory category) |
| Disable a specific log category for the global internal logger. More... | |
| void | btck_logging_disable () |
| This disables the global internal logger. More... | |
| btck_LoggingConnection * | btck_logging_connection_create (btck_LogCallback callback, void *user_data, btck_DestroyCallback user_data_destroy_callback) |
| Start logging messages through the provided callback. More... | |
| void | btck_logging_connection_destroy (btck_LoggingConnection *connection) |
| Stop logging and destroy the logging connection. More... | |
| btck_ChainParameters * | btck_chain_parameters_create (const btck_ChainType chain_type) |
| Creates a chain parameters struct with default parameters based on the passed in chain type. More... | |
| btck_ChainParameters * | btck_chain_parameters_copy (const btck_ChainParameters *chain_parameters) |
| Copy the chain parameters. More... | |
| void | btck_chain_parameters_destroy (btck_ChainParameters *chain_parameters) |
| Destroy the chain parameters. More... | |
| btck_ContextOptions * | btck_context_options_create () |
| Creates an empty context options. More... | |
| void | btck_context_options_set_chainparams (btck_ContextOptions *options, const btck_ChainParameters *chain_parameters) |
| void | btck_context_options_set_notifications (btck_ContextOptions *options, btck_NotificationInterfaceCallbacks notifications) |
| Set the kernel notifications for the context options. More... | |
| void | btck_context_options_set_validation_interface (btck_ContextOptions *options, btck_ValidationInterfaceCallbacks vi_cbs) |
| Set the validation interface callbacks for the context options. More... | |
| void | btck_context_options_destroy (btck_ContextOptions *options) |
| Destroy the context options. More... | |
| btck_Context * | btck_context_create (const btck_ContextOptions *options) |
| Create a new kernel context. More... | |
| btck_Context * | btck_context_copy (const btck_Context *context) |
| Copy the context. More... | |
| int | btck_context_interrupt (btck_Context *context) |
| Interrupt can be used to halt long-running validation functions like when reindexing, importing or processing blocks. More... | |
| void | btck_context_destroy (btck_Context *context) |
| Destroy the context. More... | |
| const btck_BlockTreeEntry * | btck_block_tree_entry_get_previous (const btck_BlockTreeEntry *entry) |
| Returns the previous block tree entry in the tree, or null if the current block tree entry is the genesis block. More... | |
| btck_ValidationMode | btck_block_validation_state_get_validation_mode (const btck_BlockValidationState *block_validation_state_) |
| Returns the validation mode from an opaque block validation state pointer. More... | |
| btck_BlockValidationResult | btck_block_validation_state_get_block_validation_result (const btck_BlockValidationState *block_validation_state_) |
| Returns the validation result from an opaque block validation state pointer. More... | |
| btck_ChainstateManagerOptions * | btck_chainstate_manager_options_create (const btck_Context *context, const char *data_dir, size_t data_dir_len, const char *blocks_dir, size_t blocks_dir_len) |
| void | btck_chainstate_manager_options_set_worker_threads_num (btck_ChainstateManagerOptions *opts, int worker_threads) |
| Set the number of available worker threads used during validation. More... | |
| void | btck_chainstate_manager_options_destroy (btck_ChainstateManagerOptions *options) |
| Destroy the chainstate manager options. More... | |
| int | btck_chainstate_manager_options_set_wipe_dbs (btck_ChainstateManagerOptions *chainman_opts, int wipe_block_tree_db, int wipe_chainstate_db) |
| Sets wipe db in the options. More... | |
| void | btck_chainstate_manager_options_update_block_tree_db_in_memory (btck_ChainstateManagerOptions *chainman_opts, int block_tree_db_in_memory) |
| Sets block tree db in memory in the options. More... | |
| void | btck_chainstate_manager_options_update_chainstate_db_in_memory (btck_ChainstateManagerOptions *chainman_opts, int chainstate_db_in_memory) |
| Sets chainstate db in memory in the options. More... | |
| btck_ChainstateManager * | btck_chainstate_manager_create (const btck_ChainstateManagerOptions *chainman_opts) |
| Create a chainstate manager. More... | |
| const btck_BlockTreeEntry * | btck_chainstate_manager_get_block_tree_entry_by_hash (const btck_ChainstateManager *chainman, const btck_BlockHash *block_hash) |
| void | btck_chainstate_manager_destroy (btck_ChainstateManager *chainman) |
| Destroy the chainstate manager. More... | |
| int | btck_chainstate_manager_import_blocks (btck_ChainstateManager *chainman, const char **block_file_paths_data, size_t *block_file_paths_lens, size_t block_file_paths_data_len) |
| Triggers the start of a reindex if the wipe options were previously set for the chainstate manager. More... | |
| btck_Block * | btck_block_create (const void *raw_block, size_t raw_block_length) |
| Parse a serialized raw block into a new block object. More... | |
| btck_Block * | btck_block_copy (const btck_Block *block) |
| Copy a block. More... | |
| size_t | btck_block_count_transactions (const btck_Block *block) |
| Count the number of transactions contained in a block. More... | |
| const btck_Transaction * | btck_block_get_transaction_at (const btck_Block *block, size_t index) |
| Get the transaction at the provided index. More... | |
| int | btck_block_to_bytes (const btck_Block *block, btck_WriteBytes writer, void *user_data) |
| btck_BlockHash * | btck_block_get_hash (const btck_Block *block) |
| Calculate and return the hash of a block. More... | |
| void | btck_block_destroy (btck_Block *block) |
| Destroy the block. More... | |
| btck_Block * | btck_block_read (const btck_ChainstateManager *chainman, const btck_BlockTreeEntry *entry) |
| int32_t | btck_block_tree_entry_get_height (const btck_BlockTreeEntry *entry) |
| Return the height of a certain block tree entry. More... | |
| const btck_BlockHash * | btck_block_tree_entry_get_block_hash (const btck_BlockTreeEntry *entry) |
| Return the block hash associated with a block tree entry. More... | |
| btck_BlockHash * | btck_block_hash_create (const unsigned char block_hash[32]) |
| Create a block hash from its raw data. More... | |
| btck_BlockHash * | btck_block_hash_copy (const btck_BlockHash *block_hash) |
| Copy a block hash. More... | |
| void | btck_block_hash_to_bytes (const btck_BlockHash *block_hash, unsigned char output[32]) |
| int | btck_block_hash_equals (const btck_BlockHash *hash1, const btck_BlockHash *hash2) |
| void | btck_block_hash_destroy (btck_BlockHash *hash) |
| Destroy the block hash. More... | |
| btck_BlockSpentOutputs * | btck_block_spent_outputs_read (const btck_ChainstateManager *chainman, const btck_BlockTreeEntry *entry) |
| btck_BlockSpentOutputs * | btck_block_spent_outputs_copy (const btck_BlockSpentOutputs *block_spent_outputs) |
| Copy a block's spent outputs. More... | |
| size_t | btck_block_spent_outputs_count (const btck_BlockSpentOutputs *block_spent_outputs) |
| Returns the number of transaction spent outputs whose data is contained in block spent outputs. More... | |
| const btck_TransactionSpentOutputs * | btck_block_spent_outputs_get_transaction_spent_outputs_at (const btck_BlockSpentOutputs *block_spent_outputs, size_t transaction_index) |
| Returns a transaction spent outputs contained in the block spent outputs at a certain index. More... | |
| void | btck_block_spent_outputs_destroy (btck_BlockSpentOutputs *block_spent_outputs) |
| Destroy the block spent outputs. More... | |
| btck_TransactionSpentOutputs * | btck_transaction_spent_outputs_copy (const btck_TransactionSpentOutputs *transaction_spent_outputs) |
| Copy a transaction's spent outputs. More... | |
| size_t | btck_transaction_spent_outputs_count (const btck_TransactionSpentOutputs *transaction_spent_outputs) |
| Returns the number of previous transaction outputs contained in the transaction spent outputs data. More... | |
| void | btck_transaction_spent_outputs_destroy (btck_TransactionSpentOutputs *transaction_spent_outputs) |
| Destroy the transaction spent outputs. More... | |
| const btck_Coin * | btck_transaction_spent_outputs_get_coin_at (const btck_TransactionSpentOutputs *transaction_spent_outputs, size_t coin_index) |
| Returns a coin contained in the transaction spent outputs at a certain index. More... | |
| btck_Coin * | btck_coin_copy (const btck_Coin *coin) |
| Copy a coin. More... | |
| uint32_t | btck_coin_confirmation_height (const btck_Coin *coin) |
| Returns the block height where the transaction that created this coin was included in. More... | |
| int | btck_coin_is_coinbase (const btck_Coin *coin) |
| Returns whether the containing transaction was a coinbase. More... | |
| const btck_TransactionOutput * | btck_coin_get_output (const btck_Coin *coin) |
| Return the transaction output of a coin. More... | |
| void | btck_coin_destroy (btck_Coin *coin) |
| Destroy the coin. More... | |
| int | btck_chainstate_manager_process_block (btck_ChainstateManager *chainman, const btck_Block *block, int *_new_block) |
| const btck_Chain * | btck_chainstate_manager_get_active_chain (const btck_ChainstateManager *chainman) |
| Returns the best known currently active chain. More... | |
| const btck_BlockTreeEntry * | btck_chain_get_tip (const btck_Chain *chain) |
| Get the block tree entry of the current chain tip. More... | |
| int | btck_chain_get_height (const btck_Chain *chain) |
| Return the height of the tip of the chain. More... | |
| const btck_BlockTreeEntry * | btck_chain_get_genesis (const btck_Chain *chain) |
| Get the block tree entry of the genesis block. More... | |
| const btck_BlockTreeEntry * | btck_chain_get_by_height (const btck_Chain *chain, int height) |
| Retrieve a block tree entry by its height in the currently active chain. More... | |
| int | btck_chain_contains (const btck_Chain *chain, const btck_BlockTreeEntry *entry) |
Variables | |
| const std::function< std::string(const char *)> | G_TRANSLATION_FUN {nullptr} |
| static const kernel::Context | btck_context_static {} |
| #define BITCOINKERNEL_BUILD |
Definition at line 5 of file bitcoinkernel.cpp.
| btck_Block * btck_block_copy | ( | const btck_Block * | block | ) |
Copy a block.
Blocks are reference counted, so this just increments the reference count.
| [in] | block | Non-null. |
Definition at line 1050 of file bitcoinkernel.cpp.
| size_t btck_block_count_transactions | ( | const btck_Block * | block | ) |
Count the number of transactions contained in a block.
| [in] | block | Non-null. |
Definition at line 1055 of file bitcoinkernel.cpp.
| btck_Block * btck_block_create | ( | const void * | raw_block, |
| size_t | raw_block_len | ||
| ) |
Parse a serialized raw block into a new block object.
| [in] | raw_block | Non-null, serialized block. |
| [in] | raw_block_len | Length of the serialized block. |
Definition at line 1034 of file bitcoinkernel.cpp.
| void btck_block_destroy | ( | btck_Block * | block | ) |
Destroy the block.
Definition at line 1082 of file bitcoinkernel.cpp.
| btck_BlockHash * btck_block_get_hash | ( | const btck_Block * | block | ) |
Calculate and return the hash of a block.
| [in] | block | Non-null. |
Definition at line 1077 of file bitcoinkernel.cpp.
| const btck_Transaction * btck_block_get_transaction_at | ( | const btck_Block * | block, |
| size_t | transaction_index | ||
| ) |
Get the transaction at the provided index.
The returned transaction is not owned and depends on the lifetime of the block.
| [in] | block | Non-null. |
| [in] | transaction_index | The index of the transaction to be retrieved. |
Definition at line 1060 of file bitcoinkernel.cpp.
| btck_BlockHash * btck_block_hash_copy | ( | const btck_BlockHash * | block_hash | ) |
Copy a block hash.
| [in] | block_hash | Non-null. |
Definition at line 1112 of file bitcoinkernel.cpp.
| btck_BlockHash * btck_block_hash_create | ( | const unsigned char | block_hash[32] | ) |
Create a block hash from its raw data.
Definition at line 1107 of file bitcoinkernel.cpp.
| void btck_block_hash_destroy | ( | btck_BlockHash * | hash | ) |
Destroy the block hash.
Definition at line 1127 of file bitcoinkernel.cpp.
| int btck_block_hash_equals | ( | const btck_BlockHash * | hash1, |
| const btck_BlockHash * | hash2 | ||
| ) |
| void btck_block_hash_to_bytes | ( | const btck_BlockHash * | block_hash, |
| unsigned char | output[32] | ||
| ) |
| btck_Block * btck_block_read | ( | const btck_ChainstateManager * | chainman, |
| const btck_BlockTreeEntry * | entry | ||
| ) |
| btck_BlockSpentOutputs * btck_block_spent_outputs_copy | ( | const btck_BlockSpentOutputs * | block_spent_outputs | ) |
Copy a block's spent outputs.
| [in] | block_spent_outputs | Non-null. |
Definition at line 1146 of file bitcoinkernel.cpp.
| size_t btck_block_spent_outputs_count | ( | const btck_BlockSpentOutputs * | block_spent_outputs | ) |
Returns the number of transaction spent outputs whose data is contained in block spent outputs.
| [in] | block_spent_outputs | Non-null. |
Definition at line 1151 of file bitcoinkernel.cpp.
| void btck_block_spent_outputs_destroy | ( | btck_BlockSpentOutputs * | block_spent_outputs | ) |
Destroy the block spent outputs.
Definition at line 1163 of file bitcoinkernel.cpp.
| const btck_TransactionSpentOutputs * btck_block_spent_outputs_get_transaction_spent_outputs_at | ( | const btck_BlockSpentOutputs * | block_spent_outputs, |
| size_t | transaction_spent_outputs_index | ||
| ) |
Returns a transaction spent outputs contained in the block spent outputs at a certain index.
The returned pointer is unowned and only valid for the lifetime of block_spent_outputs.
| [in] | block_spent_outputs | Non-null. |
| [in] | transaction_spent_outputs_index | The index of the transaction spent outputs within the block spent outputs. |
Definition at line 1156 of file bitcoinkernel.cpp.
| btck_BlockSpentOutputs * btck_block_spent_outputs_read | ( | const btck_ChainstateManager * | chainman, |
| const btck_BlockTreeEntry * | entry | ||
| ) |
| int btck_block_to_bytes | ( | const btck_Block * | block, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
| const btck_BlockHash * btck_block_tree_entry_get_block_hash | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Return the block hash associated with a block tree entry.
| [in] | block_tree_entry | Non-null. |
Definition at line 1102 of file bitcoinkernel.cpp.
| int32_t btck_block_tree_entry_get_height | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Return the height of a certain block tree entry.
| [in] | block_tree_entry | Non-null. |
Definition at line 1097 of file bitcoinkernel.cpp.
| const btck_BlockTreeEntry * btck_block_tree_entry_get_previous | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Returns the previous block tree entry in the tree, or null if the current block tree entry is the genesis block.
| [in] | block_tree_entry | Non-null. |
Definition at line 847 of file bitcoinkernel.cpp.
| btck_BlockValidationResult btck_block_validation_state_get_block_validation_result | ( | const btck_BlockValidationState * | block_validation_state_ | ) |
Returns the validation result from an opaque block validation state pointer.
Definition at line 865 of file bitcoinkernel.cpp.
| btck_ValidationMode btck_block_validation_state_get_validation_mode | ( | const btck_BlockValidationState * | block_validation_state_ | ) |
Returns the validation mode from an opaque block validation state pointer.
Definition at line 857 of file bitcoinkernel.cpp.
| int btck_chain_contains | ( | const btck_Chain * | chain, |
| const btck_BlockTreeEntry * | entry | ||
| ) |
| const btck_BlockTreeEntry * btck_chain_get_by_height | ( | const btck_Chain * | chain, |
| int | block_height | ||
| ) |
Retrieve a block tree entry by its height in the currently active chain.
Once retrieved there is no guarantee that it remains in the active chain.
| [in] | chain | Non-null. |
| [in] | block_height | Height in the chain of the to be retrieved block tree entry. |
Definition at line 1251 of file bitcoinkernel.cpp.
| const btck_BlockTreeEntry * btck_chain_get_genesis | ( | const btck_Chain * | chain | ) |
Get the block tree entry of the genesis block.
| [in] | chain | Non-null. |
Definition at line 1245 of file bitcoinkernel.cpp.
| int btck_chain_get_height | ( | const btck_Chain * | chain | ) |
Return the height of the tip of the chain.
| [in] | chain | Non-null. |
Definition at line 1239 of file bitcoinkernel.cpp.
| const btck_BlockTreeEntry * btck_chain_get_tip | ( | const btck_Chain * | chain | ) |
Get the block tree entry of the current chain tip.
Once returned, there is no guarantee that it remains in the active chain.
| [in] | chain | Non-null. |
Definition at line 1233 of file bitcoinkernel.cpp.
| btck_ChainParameters * btck_chain_parameters_copy | ( | const btck_ChainParameters * | chain_parameters | ) |
Copy the chain parameters.
Definition at line 780 of file bitcoinkernel.cpp.
| btck_ChainParameters * btck_chain_parameters_create | ( | const btck_ChainType | chain_type | ) |
Creates a chain parameters struct with default parameters based on the passed in chain type.
| [in] | chain_type | Controls the chain parameters type created. |
Definition at line 758 of file bitcoinkernel.cpp.
| void btck_chain_parameters_destroy | ( | btck_ChainParameters * | chain_parameters | ) |
Destroy the chain parameters.
Definition at line 785 of file bitcoinkernel.cpp.
| btck_ChainstateManager * btck_chainstate_manager_create | ( | const btck_ChainstateManagerOptions * | chainstate_manager_options | ) |
Create a chainstate manager.
This is the main object for many validation tasks as well as for retrieving data from the chain and interacting with its chainstate and indexes.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
Definition at line 947 of file bitcoinkernel.cpp.
| void btck_chainstate_manager_destroy | ( | btck_ChainstateManager * | chainman | ) |
Destroy the chainstate manager.
Definition at line 1001 of file bitcoinkernel.cpp.
| const btck_Chain * btck_chainstate_manager_get_active_chain | ( | const btck_ChainstateManager * | chainstate_manager | ) |
Returns the best known currently active chain.
Its lifetime is dependent on the chainstate manager. It can be thought of as a view on a vector of block tree entries that form the best chain. The returned chain reference always points to the currently active best chain. However, state transitions within the chainstate manager (e.g., processing blocks) will update the chain's contents. Data retrieved from this chain is only consistent up to the point when new data is processed in the chainstate manager. It is the user's responsibility to guard against these inconsistencies.
| [in] | chainstate_manager | Non-null. |
Definition at line 1228 of file bitcoinkernel.cpp.
| const btck_BlockTreeEntry * btck_chainstate_manager_get_block_tree_entry_by_hash | ( | const btck_ChainstateManager * | chainman, |
| const btck_BlockHash * | block_hash | ||
| ) |
| int btck_chainstate_manager_import_blocks | ( | btck_ChainstateManager * | chainstate_manager, |
| const char ** | block_file_paths_data, | ||
| size_t * | block_file_paths_lens, | ||
| size_t | block_file_paths_data_len | ||
| ) |
Triggers the start of a reindex if the wipe options were previously set for the chainstate manager.
Can also import an array of existing block files selected by the user.
| [in] | chainstate_manager | Non-null. |
| [in] | block_file_paths_data | Nullable, array of block files described by their full filesystem paths. |
| [in] | block_file_paths_lens | Nullable, array containing the lengths of each of the paths. |
| [in] | block_file_paths_data_len | Length of the block_file_paths_data and block_file_paths_len arrays. |
Definition at line 1016 of file bitcoinkernel.cpp.
| btck_ChainstateManagerOptions * btck_chainstate_manager_options_create | ( | const btck_Context * | context, |
| const char * | data_dir, | ||
| size_t | data_dir_len, | ||
| const char * | blocks_dir, | ||
| size_t | blocks_dir_len | ||
| ) |
| void btck_chainstate_manager_options_destroy | ( | btck_ChainstateManagerOptions * | options | ) |
Destroy the chainstate manager options.
Definition at line 911 of file bitcoinkernel.cpp.
| int btck_chainstate_manager_options_set_wipe_dbs | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | wipe_block_tree_db, | ||
| int | wipe_chainstate_db | ||
| ) |
Sets wipe db in the options.
In combination with calling btck_chainstate_manager_import_blocks this triggers either a full reindex, or a reindex of just the chainstate database.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
| [in] | wipe_block_tree_db | Set wipe block tree db. Should only be 1 if wipe_chainstate_db is 1 too. |
| [in] | wipe_chainstate_db | Set wipe chainstate db. |
Definition at line 916 of file bitcoinkernel.cpp.
| void btck_chainstate_manager_options_set_worker_threads_num | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | worker_threads | ||
| ) |
Set the number of available worker threads used during validation.
| [in] | chainstate_manager_options | Non-null, options to be set. |
| [in] | worker_threads | The number of worker threads that should be spawned in the thread pool used for validation. When set to 0 no parallel verification is done. The value range is clamped internally between 0 and 15. |
Definition at line 905 of file bitcoinkernel.cpp.
| void btck_chainstate_manager_options_update_block_tree_db_in_memory | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | block_tree_db_in_memory | ||
| ) |
Sets block tree db in memory in the options.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
| [in] | block_tree_db_in_memory | Set block tree db in memory. |
Definition at line 929 of file bitcoinkernel.cpp.
| void btck_chainstate_manager_options_update_chainstate_db_in_memory | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| int | chainstate_db_in_memory | ||
| ) |
Sets chainstate db in memory in the options.
| [in] | chainstate_manager_options | Non-null, created by btck_chainstate_manager_options_create. |
| [in] | chainstate_db_in_memory | Set chainstate db in memory. |
Definition at line 938 of file bitcoinkernel.cpp.
| int btck_chainstate_manager_process_block | ( | btck_ChainstateManager * | chainman, |
| const btck_Block * | block, | ||
| int * | _new_block | ||
| ) |
| uint32_t btck_coin_confirmation_height | ( | const btck_Coin * | coin | ) |
Returns the block height where the transaction that created this coin was included in.
| [in] | coin | Non-null. |
Definition at line 1195 of file bitcoinkernel.cpp.
Copy a coin.
| [in] | coin | Non-null. |
Definition at line 1190 of file bitcoinkernel.cpp.
| void btck_coin_destroy | ( | btck_Coin * | coin | ) |
Destroy the coin.
Definition at line 1210 of file bitcoinkernel.cpp.
| const btck_TransactionOutput * btck_coin_get_output | ( | const btck_Coin * | coin | ) |
Return the transaction output of a coin.
The returned pointer is unowned and only valid for the lifetime of the coin.
| [in] | coin | Non-null. |
Definition at line 1205 of file bitcoinkernel.cpp.
| int btck_coin_is_coinbase | ( | const btck_Coin * | coin | ) |
Returns whether the containing transaction was a coinbase.
| [in] | coin | Non-null. |
Definition at line 1200 of file bitcoinkernel.cpp.
| btck_Context * btck_context_copy | ( | const btck_Context * | context | ) |
Copy the context.
Definition at line 832 of file bitcoinkernel.cpp.
| btck_Context * btck_context_create | ( | const btck_ContextOptions * | context_options | ) |
Create a new kernel context.
If the options have not been previously set, their corresponding fields will be initialized to default values; the context will assume mainnet chain parameters and won't attempt to call the kernel notification callbacks.
| [in] | context_options | Nullable, created by btck_context_options_create. |
Definition at line 820 of file bitcoinkernel.cpp.
| void btck_context_destroy | ( | btck_Context * | context | ) |
Destroy the context.
Definition at line 842 of file bitcoinkernel.cpp.
| int btck_context_interrupt | ( | btck_Context * | context | ) |
Interrupt can be used to halt long-running validation functions like when reindexing, importing or processing blocks.
| [in] | context | Non-null. |
Definition at line 837 of file bitcoinkernel.cpp.
| btck_ContextOptions * btck_context_options_create | ( | ) |
Creates an empty context options.
Definition at line 790 of file bitcoinkernel.cpp.
| void btck_context_options_destroy | ( | btck_ContextOptions * | options | ) |
Destroy the context options.
Definition at line 815 of file bitcoinkernel.cpp.
| void btck_context_options_set_chainparams | ( | btck_ContextOptions * | options, |
| const btck_ChainParameters * | chain_parameters | ||
| ) |
| void btck_context_options_set_notifications | ( | btck_ContextOptions * | context_options, |
| btck_NotificationInterfaceCallbacks | notifications | ||
| ) |
Set the kernel notifications for the context options.
The context created with the options will be configured with these notifications.
| [in] | context_options | Non-null, previously created by btck_context_options_create. |
| [in] | notifications | Is set to the context options. |
Definition at line 802 of file bitcoinkernel.cpp.
| void btck_context_options_set_validation_interface | ( | btck_ContextOptions * | context_options, |
| btck_ValidationInterfaceCallbacks | validation_interface_callbacks | ||
| ) |
Set the validation interface callbacks for the context options.
The context created with the options will be configured for these validation interface callbacks. The callbacks will then be triggered from validation events issued by the chainstate manager created from the same context.
| [in] | context_options | Non-null, previously created with btck_context_options_create. |
| [in] | validation_interface_callbacks | The callbacks used for passing validation information to the user. |
Definition at line 809 of file bitcoinkernel.cpp.
| btck_LoggingConnection * btck_logging_connection_create | ( | btck_LogCallback | log_callback, |
| void * | user_data, | ||
| btck_DestroyCallback | user_data_destroy_callback | ||
| ) |
Start logging messages through the provided callback.
Log messages produced before this function is first called are buffered and on calling this function are logged immediately.
| [in] | log_callback | Non-null, function through which messages will be logged. |
| [in] | user_data | Nullable, holds a user-defined opaque structure. Is passed back to the user through the callback. If the user_data_destroy_callback is also defined it is assumed that ownership of the user_data is passed to the created logging connection. |
| [in] | user_data_destroy_callback | Nullable, function for freeing the user data. |
Definition at line 744 of file bitcoinkernel.cpp.
| void btck_logging_connection_destroy | ( | btck_LoggingConnection * | connection | ) |
Stop logging and destroy the logging connection.
Definition at line 753 of file bitcoinkernel.cpp.
| void btck_logging_disable | ( | ) |
This disables the global internal logger.
No log messages will be buffered internally anymore once this is called and the buffer is cleared. This function should only be called once and is not thread or re-entry safe. Log messages will be buffered until this function is called, or a logging connection is created. This must not be called while a logging connection already exists.
Definition at line 739 of file bitcoinkernel.cpp.
| void btck_logging_disable_category | ( | btck_LogCategory | category | ) |
Disable a specific log category for the global internal logger.
This changes a global setting and will override settings for all existing btck_LoggingConnection instances.
| [in] | category | If btck_LogCategory_ALL is chosen, all categories will be disabled. |
Definition at line 734 of file bitcoinkernel.cpp.
| void btck_logging_enable_category | ( | btck_LogCategory | category | ) |
Enable a specific log category for the global internal logger.
This changes a global setting and will override settings for all existing btck_LoggingConnection instances.
| [in] | category | If btck_LogCategory_ALL is chosen, all categories will be enabled. |
Definition at line 729 of file bitcoinkernel.cpp.
| void btck_logging_set_level_category | ( | btck_LogCategory | category, |
| btck_LogLevel | level | ||
| ) |
Set the log level of the global internal logger.
This does not enable the selected categories. Use btck_logging_enable_category to start logging from a specific, or all categories. This changes a global setting and will override settings for all existing btck_LoggingConnection instances.
| [in] | category | If btck_LogCategory_ALL is chosen, sets both the global fallback log level used by all categories that don't have a specific level set, and also sets the log level for messages logged with the btck_LogCategory_ALL category itself. For any other category, sets a category-specific log level that overrides the global fallback for that category only. |
| [in] | level | Log level at which the log category is set. |
Definition at line 719 of file bitcoinkernel.cpp.
| void btck_logging_set_options | ( | const btck_LoggingOptions | options | ) |
Set some options for the global internal logger.
This changes global settings and will override settings for all existing btck_LoggingConnection instances.
| [in] | options | Sets formatting options of the log messages. |
Definition at line 709 of file bitcoinkernel.cpp.
| btck_ScriptPubkey * btck_script_pubkey_copy | ( | const btck_ScriptPubkey * | script_pubkey | ) |
Copy a script pubkey.
| [in] | script_pubkey | Non-null. |
Definition at line 569 of file bitcoinkernel.cpp.
| btck_ScriptPubkey * btck_script_pubkey_create | ( | const void * | script_pubkey, |
| size_t | script_pubkey_len | ||
| ) |
Create a script pubkey from serialized data.
| [in] | script_pubkey | Non-null. |
| [in] | script_pubkey_len | Length of the script pubkey data. |
Definition at line 557 of file bitcoinkernel.cpp.
| void btck_script_pubkey_destroy | ( | btck_ScriptPubkey * | script_pubkey | ) |
Destroy the script pubkey.
Definition at line 574 of file bitcoinkernel.cpp.
| int btck_script_pubkey_to_bytes | ( | const btck_ScriptPubkey * | script_pubkey_, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
| int btck_script_pubkey_verify | ( | const btck_ScriptPubkey * | script_pubkey, |
| const int64_t | amount, | ||
| const btck_Transaction * | tx_to, | ||
| const btck_TransactionOutput ** | spent_outputs_, | ||
| size_t | spent_outputs_len, | ||
| const unsigned int | input_index, | ||
| const btck_ScriptVerificationFlags | flags, | ||
| btck_ScriptVerifyStatus * | status | ||
| ) |
Definition at line 604 of file bitcoinkernel.cpp.
| btck_Transaction * btck_transaction_copy | ( | const btck_Transaction * | transaction | ) |
Copy a transaction.
Transactions are reference counted, so this just increments the reference count.
| [in] | transaction | Non-null. |
Definition at line 536 of file bitcoinkernel.cpp.
| size_t btck_transaction_count_inputs | ( | const btck_Transaction * | transaction | ) |
Get the number of inputs of a transaction.
| [in] | transaction | Non-null. |
Definition at line 520 of file bitcoinkernel.cpp.
| size_t btck_transaction_count_outputs | ( | const btck_Transaction * | transaction | ) |
Get the number of outputs of a transaction.
| [in] | transaction | Non-null. |
Definition at line 508 of file bitcoinkernel.cpp.
| btck_Transaction * btck_transaction_create | ( | const void * | raw_transaction, |
| size_t | raw_transaction_len | ||
| ) |
Create a new transaction from the serialized data.
| [in] | raw_transaction | Non-null. |
| [in] | raw_transaction_len | Length of the serialized transaction. |
Definition at line 498 of file bitcoinkernel.cpp.
| void btck_transaction_destroy | ( | btck_Transaction * | transaction | ) |
Destroy the transaction.
Definition at line 552 of file bitcoinkernel.cpp.
| const btck_TransactionInput * btck_transaction_get_input_at | ( | const btck_Transaction * | transaction, |
| size_t | input_index | ||
| ) |
Get the transaction input at the provided index.
The returned transaction input is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
| [in] | input_index | The index of the transaction input to be retrieved. |
Definition at line 525 of file bitcoinkernel.cpp.
| const btck_TransactionOutput * btck_transaction_get_output_at | ( | const btck_Transaction * | transaction, |
| size_t | output_index | ||
| ) |
Get the transaction outputs at the provided index.
The returned transaction output is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
| [in] | output_index | The index of the transaction output to be retrieved. |
Definition at line 513 of file bitcoinkernel.cpp.
| const btck_Txid * btck_transaction_get_txid | ( | const btck_Transaction * | transaction | ) |
Get the txid of a transaction.
The returned txid is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
Definition at line 531 of file bitcoinkernel.cpp.
| btck_TransactionInput * btck_transaction_input_copy | ( | const btck_TransactionInput * | transaction_input | ) |
Copy a transaction input.
| [in] | transaction_input | Non-null. |
Definition at line 654 of file bitcoinkernel.cpp.
| void btck_transaction_input_destroy | ( | btck_TransactionInput * | input | ) |
Destroy the transaction input.
Definition at line 664 of file bitcoinkernel.cpp.
| const btck_TransactionOutPoint * btck_transaction_input_get_out_point | ( | const btck_TransactionInput * | transaction_input | ) |
Get the transaction out point.
The returned transaction out point is not owned and depends on the lifetime of the transaction.
| [in] | transaction_input | Non-null. |
Definition at line 659 of file bitcoinkernel.cpp.
| btck_TransactionOutPoint * btck_transaction_out_point_copy | ( | const btck_TransactionOutPoint * | transaction_out_point | ) |
Copy a transaction out point.
| [in] | transaction_out_point | Non-null. |
Definition at line 669 of file bitcoinkernel.cpp.
| void btck_transaction_out_point_destroy | ( | btck_TransactionOutPoint * | out_point | ) |
Destroy the transaction out point.
Definition at line 684 of file bitcoinkernel.cpp.
| uint32_t btck_transaction_out_point_get_index | ( | const btck_TransactionOutPoint * | transaction_out_point | ) |
Get the output position from the transaction out point.
| [in] | transaction_out_point | Non-null. |
Definition at line 674 of file bitcoinkernel.cpp.
| const btck_Txid * btck_transaction_out_point_get_txid | ( | const btck_TransactionOutPoint * | transaction_out_point | ) |
Get the txid from the transaction out point.
The returned txid is not owned and depends on the lifetime of the transaction out point.
| [in] | transaction_out_point | Non-null. |
Definition at line 679 of file bitcoinkernel.cpp.
| btck_TransactionOutput * btck_transaction_output_copy | ( | const btck_TransactionOutput * | transaction_output | ) |
Copy a transaction output.
| [in] | transaction_output | Non-null. |
Definition at line 584 of file bitcoinkernel.cpp.
| btck_TransactionOutput * btck_transaction_output_create | ( | const btck_ScriptPubkey * | script_pubkey, |
| int64_t | amount | ||
| ) |
Create a transaction output from a script pubkey and an amount.
| [in] | script_pubkey | Non-null. |
| [in] | amount | The amount associated with the script pubkey for this output. |
Definition at line 579 of file bitcoinkernel.cpp.
| void btck_transaction_output_destroy | ( | btck_TransactionOutput * | output | ) |
Destroy the transaction output.
Definition at line 599 of file bitcoinkernel.cpp.
| int64_t btck_transaction_output_get_amount | ( | const btck_TransactionOutput * | transaction_output | ) |
Get the amount in the output.
| [in] | transaction_output | Non-null. |
Definition at line 594 of file bitcoinkernel.cpp.
| const btck_ScriptPubkey * btck_transaction_output_get_script_pubkey | ( | const btck_TransactionOutput * | transaction_output | ) |
Get the script pubkey of the output.
The returned script pubkey is not owned and depends on the lifetime of the transaction output.
| [in] | transaction_output | Non-null. |
Definition at line 589 of file bitcoinkernel.cpp.
| btck_TransactionSpentOutputs * btck_transaction_spent_outputs_copy | ( | const btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Copy a transaction's spent outputs.
| [in] | transaction_spent_outputs | Non-null. |
Definition at line 1168 of file bitcoinkernel.cpp.
| size_t btck_transaction_spent_outputs_count | ( | const btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Returns the number of previous transaction outputs contained in the transaction spent outputs data.
| [in] | transaction_spent_outputs | Non-null |
Definition at line 1173 of file bitcoinkernel.cpp.
| void btck_transaction_spent_outputs_destroy | ( | btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Destroy the transaction spent outputs.
Definition at line 1178 of file bitcoinkernel.cpp.
| const btck_Coin * btck_transaction_spent_outputs_get_coin_at | ( | const btck_TransactionSpentOutputs * | transaction_spent_outputs, |
| size_t | coin_index | ||
| ) |
Returns a coin contained in the transaction spent outputs at a certain index.
The returned pointer is unowned and only valid for the lifetime of transaction_spent_outputs.
| [in] | transaction_spent_outputs | Non-null. |
| [in] | coin_index | The index of the to be retrieved coin within the transaction spent outputs. |
Definition at line 1183 of file bitcoinkernel.cpp.
| int btck_transaction_to_bytes | ( | const btck_Transaction * | transaction, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Copy a txid.
| [in] | txid | Non-null. |
Definition at line 689 of file bitcoinkernel.cpp.
| void btck_txid_destroy | ( | btck_Txid * | txid | ) |
Destroy the txid.
Definition at line 704 of file bitcoinkernel.cpp.
| void btck_txid_to_bytes | ( | const btck_Txid * | txid, |
| unsigned char | output[32] | ||
| ) |
|
static |
Definition at line 60 of file bitcoinkernel.cpp.
|
extern |
Definition at line 53 of file bitcoin-cli.cpp.