![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
#include <kernel/bitcoinkernel.h>#include <attributes.h>#include <chain.h>#include <coins.h>#include <consensus/tx_check.h>#include <consensus/validation.h>#include <dbwrapper.h>#include <kernel/caches.h>#include <kernel/chainparams.h>#include <kernel/checks.h>#include <kernel/context.h>#include <kernel/notifications_interface.h>#include <kernel/warning.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 <script/verify_flags.h>#include <serialize.h>#include <streams.h>#include <sync.h>#include <uint256.h>#include <undo.h>#include <util/check.h>#include <util/fs.h>#include <util/log.h>#include <util/result.h>#include <util/signalinterrupt.h>#include <util/stdmutex.h>#include <util/string.h>#include <util/task_runner.h>#include <util/time.h>#include <util/translation.h>#include <validation.h>#include <validationinterface.h>#include <atomic>#include <cstddef>#include <cstring>#include <exception>#include <iterator>#include <limits>#include <list>#include <memory>#include <optional>#include <span>#include <stdexcept>#include <string>#include <string_view>#include <tuple>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | btck_BlockTreeEntry |
| struct | btck_LogEntry |
| struct | btck_Block |
| struct | btck_BlockValidationState |
| struct | btck_TxValidationState |
| 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_WitnessStack |
| struct | btck_TransactionOutPoint |
| struct | btck_Txid |
| struct | btck_Wtxid |
| struct | btck_PrecomputedTransactionData |
| struct | btck_BlockHeader |
| struct | btck_ConsensusParams |
Namespaces | |
| namespace | Consensus |
| Transaction validation functions. | |
| namespace | util |
| namespace | util::log |
Macros | |
| #define | BITCOINKERNEL_BUILD |
Variables | |
| const TranslateFn | G_TRANSLATION_FUN {nullptr} |
| static const kernel::Context | btck_context_static {} |
| #define BITCOINKERNEL_BUILD |
Definition at line 5 of file bitcoinkernel.cpp.
| int btck_block_check | ( | const btck_Block * | block, |
| const btck_ConsensusParams * | consensus_params, | ||
| btck_BlockCheckFlags | flags, | ||
| btck_BlockValidationState * | validation_state | ||
| ) |
Definition at line 1410 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 1405 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 1423 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 | Serialized block. |
| [in] | raw_block_len | Length of the serialized block. |
Definition at line 1388 of file bitcoinkernel.cpp.
| void btck_block_destroy | ( | btck_Block * | block | ) |
Destroy the block.
Definition at line 1456 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 1451 of file bitcoinkernel.cpp.
| btck_BlockHeader * btck_block_get_header | ( | const btck_Block * | block | ) |
Get the btck_BlockHeader from the block.
Creates a new btck_BlockHeader object from the block's header data.
| [in] | block | Non-null btck_Block |
Definition at line 1434 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 1428 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 1496 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 1491 of file bitcoinkernel.cpp.
| void btck_block_hash_destroy | ( | btck_BlockHash * | hash | ) |
Destroy the block hash.
Definition at line 1511 of file bitcoinkernel.cpp.
| int btck_block_hash_equals | ( | const btck_BlockHash * | hash1, |
| const btck_BlockHash * | hash2 | ||
| ) |
Definition at line 1506 of file bitcoinkernel.cpp.
| void btck_block_hash_to_bytes | ( | const btck_BlockHash * | block_hash, |
| unsigned char | output[32] | ||
| ) |
| btck_BlockHeader * btck_block_header_copy | ( | const btck_BlockHeader * | header | ) |
Copy a btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader. |
Definition at line 1668 of file bitcoinkernel.cpp.
| btck_BlockHeader * btck_block_header_create | ( | const void * | raw_block_header, |
| size_t | raw_block_header_len | ||
| ) |
Create a btck_BlockHeader from serialized data.
| [in] | raw_block_header | Non-null, serialized header data (80 bytes) |
| [in] | raw_block_header_len | Length of serialized header (must be 80) |
Definition at line 1652 of file bitcoinkernel.cpp.
| void btck_block_header_destroy | ( | btck_BlockHeader * | header | ) |
Destroy the btck_BlockHeader.
Definition at line 1718 of file bitcoinkernel.cpp.
| uint32_t btck_block_header_get_bits | ( | const btck_BlockHeader * | header | ) |
Get the nBits difficulty target from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1693 of file bitcoinkernel.cpp.
| btck_BlockHash * btck_block_header_get_hash | ( | const btck_BlockHeader * | header | ) |
Get the btck_BlockHash.
| [in] | header | Non-null header |
Definition at line 1673 of file bitcoinkernel.cpp.
| void btck_block_header_get_merkle_root | ( | const btck_BlockHeader * | header, |
| unsigned char | output[32] | ||
| ) |
| uint32_t btck_block_header_get_nonce | ( | const btck_BlockHeader * | header | ) |
Get the nonce from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1703 of file bitcoinkernel.cpp.
| const btck_BlockHash * btck_block_header_get_prev_hash | ( | const btck_BlockHeader * | header | ) |
Get the previous btck_BlockHash from btck_BlockHeader.
The returned hash is unowned and only valid for the lifetime of the btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1678 of file bitcoinkernel.cpp.
| uint32_t btck_block_header_get_timestamp | ( | const btck_BlockHeader * | header | ) |
Get the timestamp from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1688 of file bitcoinkernel.cpp.
| int32_t btck_block_header_get_version | ( | const btck_BlockHeader * | header | ) |
Get the version from btck_BlockHeader.
| [in] | header | Non-null btck_BlockHeader |
Definition at line 1698 of file bitcoinkernel.cpp.
| int btck_block_header_to_bytes | ( | const btck_BlockHeader * | header, |
| unsigned char | output[80] | ||
| ) |
| 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 1530 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 1535 of file bitcoinkernel.cpp.
| void btck_block_spent_outputs_destroy | ( | btck_BlockSpentOutputs * | block_spent_outputs | ) |
Destroy the block spent outputs.
Definition at line 1547 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 1540 of file bitcoinkernel.cpp.
| btck_BlockSpentOutputs * btck_block_spent_outputs_read | ( | const btck_ChainstateManager * | chainman, |
| const btck_BlockTreeEntry * | entry | ||
| ) |
Definition at line 1516 of file bitcoinkernel.cpp.
| int btck_block_to_bytes | ( | const btck_Block * | block, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Definition at line 1440 of file bitcoinkernel.cpp.
| int btck_block_tree_entry_equals | ( | const btck_BlockTreeEntry * | entry1, |
| const btck_BlockTreeEntry * | entry2 | ||
| ) |
Definition at line 1486 of file bitcoinkernel.cpp.
| const btck_BlockTreeEntry * btck_block_tree_entry_get_ancestor | ( | const btck_BlockTreeEntry * | block_tree_entry, |
| int32_t | height | ||
| ) |
Return the ancestor of a btck_BlockTreeEntry at the given height.
| [in] | block_tree_entry | Non-null. |
| [in] | height | The height of the requested ancestor. |
Definition at line 1165 of file bitcoinkernel.cpp.
| 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 1481 of file bitcoinkernel.cpp.
| btck_BlockHeader * btck_block_tree_entry_get_block_header | ( | const btck_BlockTreeEntry * | block_tree_entry | ) |
Return the btck_BlockHeader associated with this entry.
| [in] | block_tree_entry | Non-null. |
Definition at line 1471 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 1476 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 1155 of file bitcoinkernel.cpp.
| btck_BlockValidationState * btck_block_validation_state_copy | ( | const btck_BlockValidationState * | block_validation_state | ) |
Copies the btck_BlockValidationState.
| [in] | block_validation_state | Non-null. |
Definition at line 1177 of file bitcoinkernel.cpp.
| btck_BlockValidationState * btck_block_validation_state_create | ( | ) |
Create a new btck_BlockValidationState.
Definition at line 1172 of file bitcoinkernel.cpp.
| void btck_block_validation_state_destroy | ( | btck_BlockValidationState * | state | ) |
Destroy the btck_BlockValidationState.
Definition at line 1182 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 btck_BlockValidationState pointer.
Definition at line 1195 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 btck_BlockValidationState pointer.
Definition at line 1187 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, |
| int32_t | 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 1640 of file bitcoinkernel.cpp.
| int32_t btck_chain_get_height | ( | const btck_Chain * | chain | ) |
Return the height of the tip of the chain.
| [in] | chain | Non-null. |
Definition at line 1634 of file bitcoinkernel.cpp.
| btck_ChainParameters * btck_chain_parameters_copy | ( | const btck_ChainParameters * | chain_parameters | ) |
Copy the chain parameters.
Definition at line 1083 of file bitcoinkernel.cpp.
| btck_ChainParameters * btck_chain_parameters_create | ( | 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 1051 of file bitcoinkernel.cpp.
| btck_ChainParameters * btck_chain_parameters_create_signet | ( | const void * | challenge, |
| size_t | challenge_len | ||
| ) |
Create a signet chain parameters struct with a user-provided challenge.
| [in] | challenge | The signet challenge value. Blocks must satisfy it in order to be valid. |
| [in] | challenge_len | The length of the signet challenge. |
Definition at line 1073 of file bitcoinkernel.cpp.
| void btck_chain_parameters_destroy | ( | btck_ChainParameters * | chain_parameters | ) |
Destroy the chain parameters.
Definition at line 1093 of file bitcoinkernel.cpp.
| const btck_ConsensusParams * btck_chain_parameters_get_consensus_params | ( | const btck_ChainParameters * | chain_parameters | ) |
Get btck_ConsensusParams from btck_ChainParameters.
The returned btck_ConsensusParams pointer is valid only for the lifetime of the btck_ChainParameters object and must not be destroyed by the caller.
| [in] | chain_parameters | Non-null. |
Definition at line 1088 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 1297 of file bitcoinkernel.cpp.
| void btck_chainstate_manager_destroy | ( | btck_ChainstateManager * | chainman | ) |
Destroy the chainstate manager.
Definition at line 1353 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 1629 of file bitcoinkernel.cpp.
| const btck_BlockTreeEntry * btck_chainstate_manager_get_best_entry | ( | const btck_ChainstateManager * | chainstate_manager | ) |
Get the btck_BlockTreeEntry whose associated btck_BlockHeader has the most known cumulative proof of work.
| [in] | chainstate_manager | Non-null. |
Definition at line 1347 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 | ||
| ) |
Definition at line 1336 of file bitcoinkernel.cpp.
| 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.
Do not call this while another btck_chainstate_manager_import_blocks call on the same chainstate manager is in progress. The process aborts when this is detected.
| [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 1368 of file bitcoinkernel.cpp.
| btck_ChainstateManagerOptions * btck_chainstate_manager_options_create | ( | const btck_Context * | context, |
| const char * | data_directory, | ||
| size_t | data_directory_len, | ||
| const char * | blocks_directory, | ||
| size_t | blocks_directory_len | ||
| ) |
Create options for the chainstate manager.
| [in] | context | Non-null, the created options and through it the chainstate manager will associate with this kernel context for the duration of their lifetimes. |
| [in] | data_directory | Path string of the directory containing the chainstate data. If the directory does not exist yet, it will be created. |
| [in] | blocks_directory | Path string of the directory containing the block data. If the directory does not exist yet, it will be created. |
Definition at line 1221 of file bitcoinkernel.cpp.
| void btck_chainstate_manager_options_destroy | ( | btck_ChainstateManagerOptions * | options | ) |
Destroy the chainstate manager options.
Definition at line 1261 of file bitcoinkernel.cpp.
| int btck_chainstate_manager_options_set_database_cache_bytes | ( | btck_ChainstateManagerOptions * | chainstate_manager_options, |
| uint64_t | database_cache_bytes | ||
| ) |
Set the total database cache used by the chainstate manager.
The total cache is split internally between the block tree database, chainstate database, and in-memory coins cache. If this function is not called, the total cache defaults to 450 MiB.
| [in] | chainstate_manager_options | Non-null, options to be set. |
| [in] | database_cache_bytes | The total database cache size in bytes. Values below 4 MiB are rejected. On 32-bit systems, values above 1 GiB are also rejected. |
Definition at line 1247 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 1266 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 1241 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 1279 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 1288 of file bitcoinkernel.cpp.
| int btck_chainstate_manager_process_block | ( | btck_ChainstateManager * | chainman, |
| const btck_Block * | block, | ||
| int * | _new_block | ||
| ) |
Definition at line 1599 of file bitcoinkernel.cpp.
| btck_BlockValidationState * btck_chainstate_manager_process_block_header | ( | btck_ChainstateManager * | chainstate_manager, |
| const btck_BlockHeader * | header | ||
| ) |
Definition at line 1612 of file bitcoinkernel.cpp.
Returns the block height where the transaction that created this coin was included in.
| [in] | coin | Non-null. |
Definition at line 1579 of file bitcoinkernel.cpp.
Copy a coin.
| [in] | coin | Non-null. |
Definition at line 1574 of file bitcoinkernel.cpp.
Destroy the coin.
Definition at line 1594 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 1589 of file bitcoinkernel.cpp.
Returns whether the containing transaction was a coinbase.
| [in] | coin | Non-null. |
Definition at line 1584 of file bitcoinkernel.cpp.
| btck_Context * btck_context_copy | ( | const btck_Context * | context | ) |
Copy the context.
Definition at line 1140 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 1128 of file bitcoinkernel.cpp.
| void btck_context_destroy | ( | btck_Context * | context | ) |
Destroy the context.
Definition at line 1150 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 1145 of file bitcoinkernel.cpp.
| btck_ContextOptions * btck_context_options_create | ( | ) |
Creates an empty context options.
Definition at line 1098 of file bitcoinkernel.cpp.
| void btck_context_options_destroy | ( | btck_ContextOptions * | options | ) |
Destroy the context options.
Definition at line 1123 of file bitcoinkernel.cpp.
| void btck_context_options_set_chainparams | ( | btck_ContextOptions * | options, |
| const btck_ChainParameters * | chain_parameters | ||
| ) |
Definition at line 1103 of file bitcoinkernel.cpp.
| 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 1110 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 1117 of file bitcoinkernel.cpp.
| btck_LogCategory btck_log_entry_get_category | ( | const btck_LogEntry * | entry | ) |
Get the category of the log entry.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1046 of file bitcoinkernel.cpp.
| btck_StringView btck_log_entry_get_file_name | ( | const btck_LogEntry * | entry | ) |
Get the name of the source file that produced the log statement.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1026 of file bitcoinkernel.cpp.
| btck_StringView btck_log_entry_get_function_name | ( | const btck_LogEntry * | entry | ) |
Get the name of the function that produced the log statement.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1031 of file bitcoinkernel.cpp.
| btck_LogLevel btck_log_entry_get_level | ( | const btck_LogEntry * | entry | ) |
Get the severity level of the log entry.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1041 of file bitcoinkernel.cpp.
| uint32_t btck_log_entry_get_line | ( | const btck_LogEntry * | entry | ) |
Get the line number of the source code that produced the log statement.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1036 of file bitcoinkernel.cpp.
| btck_StringView btck_log_entry_get_message | ( | const btck_LogEntry * | entry | ) |
Get the message text from a btck_LogEntry.
The message is not escaped, so it may contain newlines and other control characters.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1005 of file bitcoinkernel.cpp.
| int64_t btck_log_entry_get_mocktime_s | ( | const btck_LogEntry * | entry | ) |
Get the mock time in effect when the entry was logged.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1021 of file bitcoinkernel.cpp.
| btck_StringView btck_log_entry_get_thread_name | ( | const btck_LogEntry * | entry | ) |
Get the name of the thread that produced the log message.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1011 of file bitcoinkernel.cpp.
| int64_t btck_log_entry_get_timestamp_ns | ( | const btck_LogEntry * | entry | ) |
Get the wall-clock time when the entry was logged.
| [in] | entry | Non-null btck_LogEntry |
Definition at line 1016 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.
| [in] | log_callback | Non-null, function through which log entries will be delivered. |
| [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. Not called if user_data is null. |
Definition at line 984 of file bitcoinkernel.cpp.
| void btck_logging_connection_destroy | ( | btck_LoggingConnection * | connection | ) |
Stop logging and destroy the logging connection.
Definition at line 998 of file bitcoinkernel.cpp.
| void btck_logging_set_min_level | ( | btck_LogLevel | level | ) |
Set the minimum log level.
Messages below this level are not delivered to logging callbacks. Defaults to Info.
This changes a global setting and will affect all existing btck_LoggingConnection instances.
| [in] | level | Minimum log level. |
Definition at line 979 of file bitcoinkernel.cpp.
| btck_PrecomputedTransactionData * btck_precomputed_transaction_data_copy | ( | const btck_PrecomputedTransactionData * | precomputed_txdata | ) |
Copy precomputed transaction data.
| [in] | precomputed_txdata | Non-null. |
Definition at line 787 of file bitcoinkernel.cpp.
| btck_PrecomputedTransactionData * btck_precomputed_transaction_data_create | ( | const btck_Transaction * | tx_to, |
| const btck_TransactionOutput ** | spent_outputs, | ||
| size_t | spent_outputs_len | ||
| ) |
Create precomputed transaction data for script verification.
| [in] | tx_to | Non-null. |
| [in] | spent_outputs | Nullable for non-taproot verification. Points to an array of outputs spent by the transaction. |
| [in] | spent_outputs_len | Length of the spent_outputs array. |
Definition at line 761 of file bitcoinkernel.cpp.
| void btck_precomputed_transaction_data_destroy | ( | btck_PrecomputedTransactionData * | precomputed_txdata | ) |
Destroy the precomputed transaction data.
Definition at line 792 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 726 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 | Serialized script pubkey. |
| [in] | script_pubkey_len | Length of the script pubkey data. |
Definition at line 713 of file bitcoinkernel.cpp.
| void btck_script_pubkey_destroy | ( | btck_ScriptPubkey * | script_pubkey | ) |
Destroy the script pubkey.
Definition at line 731 of file bitcoinkernel.cpp.
| int btck_script_pubkey_to_bytes | ( | const btck_ScriptPubkey * | script_pubkey_, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Definition at line 720 of file bitcoinkernel.cpp.
| int btck_script_pubkey_verify | ( | const btck_ScriptPubkey * | script_pubkey, |
| const int64_t | amount, | ||
| const btck_Transaction * | tx_to, | ||
| const btck_PrecomputedTransactionData * | precomputed_txdata, | ||
| const unsigned int | input_index, | ||
| const btck_ScriptVerificationFlags | flags, | ||
| btck_ScriptVerifyStatus * | status | ||
| ) |
Definition at line 797 of file bitcoinkernel.cpp.
Override the current time with a fixed timestamp for testing.
Affects all kernel time reads globally. The caller is responsible for gating usage (e.g. restricting to regtest) if desired.
The upper bound (4294967295) matches the maximum value of a block header timestamp.
| [in] | timestamp | Unix epoch seconds, or 0 to restore the system clock. |
Definition at line 1769 of file bitcoinkernel.cpp.
| int btck_transaction_check | ( | const btck_Transaction * | tx, |
| btck_TxValidationState * | validation_state | ||
| ) |
Definition at line 1761 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 692 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 656 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 644 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 | Serialized transaction. |
| [in] | raw_transaction_len | Length of the serialized transaction. |
Definition at line 633 of file bitcoinkernel.cpp.
| void btck_transaction_destroy | ( | btck_Transaction * | transaction | ) |
Destroy the transaction.
Definition at line 708 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 661 of file bitcoinkernel.cpp.
| uint32_t btck_transaction_get_locktime | ( | const btck_Transaction * | transaction | ) |
Get a transaction's nLockTime value.
| [in] | transaction | Non-null. |
Definition at line 672 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 649 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 677 of file bitcoinkernel.cpp.
| uint32_t btck_transaction_get_version | ( | const btck_Transaction * | transaction | ) |
Get a transaction's version.
| [in] | transaction | Non-null. |
Definition at line 667 of file bitcoinkernel.cpp.
| const btck_Wtxid * btck_transaction_get_wtxid | ( | const btck_Transaction * | transaction | ) |
Get the wtxid of a transaction.
The returned wtxid is not owned and depends on the lifetime of the transaction.
| [in] | transaction | Non-null. |
Definition at line 687 of file bitcoinkernel.cpp.
| int btck_transaction_has_witness | ( | const btck_Transaction * | transaction | ) |
Check whether a transaction has witness data.
| [in] | transaction | Non-null. |
Definition at line 682 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 834 of file bitcoinkernel.cpp.
| void btck_transaction_input_destroy | ( | btck_TransactionInput * | input | ) |
Destroy the transaction input.
Definition at line 860 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 839 of file bitcoinkernel.cpp.
| int btck_transaction_input_get_script_sig | ( | const btck_TransactionInput * | input, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Definition at line 854 of file bitcoinkernel.cpp.
| uint32_t btck_transaction_input_get_sequence | ( | const btck_TransactionInput * | transaction_input | ) |
Get a transaction input's nSequence value.
| [in] | transaction_input | Non-null. |
Definition at line 844 of file bitcoinkernel.cpp.
| const btck_WitnessStack * btck_transaction_input_get_witness_stack | ( | const btck_TransactionInput * | transaction_input | ) |
Get the witness stack of a transaction input.
The returned witness stack is not owned and depends on the lifetime of the transaction input.
| [in] | transaction_input | Non-null. |
Definition at line 849 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 887 of file bitcoinkernel.cpp.
| void btck_transaction_out_point_destroy | ( | btck_TransactionOutPoint * | out_point | ) |
Destroy the transaction out point.
Definition at line 902 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 892 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 897 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 741 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 736 of file bitcoinkernel.cpp.
| void btck_transaction_output_destroy | ( | btck_TransactionOutput * | output | ) |
Destroy the transaction output.
Definition at line 756 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 751 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 746 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 1552 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 1557 of file bitcoinkernel.cpp.
| void btck_transaction_spent_outputs_destroy | ( | btck_TransactionSpentOutputs * | transaction_spent_outputs | ) |
Destroy the transaction spent outputs.
Definition at line 1562 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 1567 of file bitcoinkernel.cpp.
| int btck_transaction_to_bytes | ( | const btck_Transaction * | transaction, |
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Definition at line 697 of file bitcoinkernel.cpp.
| btck_TxValidationState * btck_tx_validation_state_create | ( | ) |
Create a new btck_TxValidationState.
Definition at line 1731 of file bitcoinkernel.cpp.
| void btck_tx_validation_state_destroy | ( | btck_TxValidationState * | state | ) |
Destroy the btck_TxValidationState.
Definition at line 1756 of file bitcoinkernel.cpp.
| btck_TxValidationResult btck_tx_validation_state_get_tx_validation_result | ( | const btck_TxValidationState * | state | ) |
Returns the validation result from an opaque btck_TxValidationState pointer.
btck_transaction_check currently produces only btck_TxValidationResult_UNSET for valid transactions and btck_TxValidationResult_CONSENSUS for invalid ones. Other values remain exposed for forward compatibility with higher-level validation entry points.
Definition at line 1736 of file bitcoinkernel.cpp.
| btck_ValidationMode btck_tx_validation_state_get_validation_mode | ( | const btck_TxValidationState * | state_ | ) |
Returns the validation mode from an opaque btck_TxValidationState pointer.
Definition at line 1723 of file bitcoinkernel.cpp.
Copy a txid.
| [in] | txid | Non-null. |
Definition at line 907 of file bitcoinkernel.cpp.
Destroy the txid.
Definition at line 922 of file bitcoinkernel.cpp.
Definition at line 917 of file bitcoinkernel.cpp.
| btck_WitnessStack * btck_witness_stack_copy | ( | const btck_WitnessStack * | witness_stack | ) |
Copy a witness stack.
| [in] | witness_stack | Non-null. |
Definition at line 877 of file bitcoinkernel.cpp.
| size_t btck_witness_stack_count_items | ( | const btck_WitnessStack * | witness_stack | ) |
Return the number of items in a witness stack.
| [in] | witness_stack | Non-null. |
Definition at line 865 of file bitcoinkernel.cpp.
| void btck_witness_stack_destroy | ( | btck_WitnessStack * | witness_stack | ) |
Destroy the witness stack.
Definition at line 882 of file bitcoinkernel.cpp.
| int btck_witness_stack_get_item_at | ( | const btck_WitnessStack * | witness_stack, |
| size_t | index, | ||
| btck_WriteBytes | writer, | ||
| void * | user_data | ||
| ) |
Definition at line 870 of file bitcoinkernel.cpp.
| btck_Wtxid * btck_wtxid_copy | ( | const btck_Wtxid * | wtxid | ) |
Copy a wtxid.
| [in] | wtxid | Non-null. |
Definition at line 927 of file bitcoinkernel.cpp.
| void btck_wtxid_destroy | ( | btck_Wtxid * | wtxid | ) |
Destroy the wtxid.
Definition at line 942 of file bitcoinkernel.cpp.
| int btck_wtxid_equals | ( | const btck_Wtxid * | wtxid1, |
| const btck_Wtxid * | wtxid2 | ||
| ) |
Definition at line 937 of file bitcoinkernel.cpp.
| void btck_wtxid_to_bytes | ( | const btck_Wtxid * | wtxid, |
| unsigned char | output[32] | ||
| ) |
Definition at line 932 of file bitcoinkernel.cpp.
|
static |
Definition at line 74 of file bitcoinkernel.cpp.
|
extern |
Definition at line 61 of file bitcoin-cli.cpp.