Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Concepts | Macros | Functions | Variables
test_kernel.cpp File Reference
#include <kernel/bitcoinkernel.h>
#include <kernel/bitcoinkernel_wrapper.h>
#include <util/byte_units.h>
#include <util/fs.h>
#include <boost/test/included/unit_test.hpp>
#include <test/kernel/block_data.h>
#include <test/util/common.h>
#include <algorithm>
#include <charconv>
#include <concepts>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <map>
#include <memory>
#include <optional>
#include <random>
#include <ranges>
#include <span>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for test_kernel.cpp:

Go to the source code of this file.

Classes

class  TestLog
 
struct  TestDirectory
 
class  TestKernelNotifications
 
class  TestValidationInterface
 
class  CountingLog
 Counts delivered entries per message, and its own destruction, which the kernel triggers through the user_data_destroy_callback when the connection is destroyed. More...
 
class  KernelMockTime
 

Concepts

concept  HasToBytes
 

Macros

#define BOOST_TEST_DISABLE_ALT_STACK
 
#define BOOST_TEST_MODULE   Bitcoin Kernel Test Suite
 

Functions

std::string random_string (uint32_t length)
 
std::vector< std::byte > hex_string_to_byte_vec (std::string_view hex)
 
std::string byte_span_to_hex_string_reversed (std::span< const std::byte > bytes)
 
void check_equal (std::span< const std::byte > _actual, std::span< const std::byte > _expected)
 
void run_verify_test (const ScriptPubkey &spent_script_pubkey, const Transaction &spending_tx, const PrecomputedTransactionData *precomputed_txdata, int64_t amount, unsigned int input_index, bool taproot)
 
template<typename T >
void CheckHandle (T object, T distinct_object)
 
template<typename RangeType >
requires std::ranges::random_access_range<RangeType>
void CheckRange (const RangeType &range, size_t expected_size)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_tests)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_id_tests)
 
 BOOST_AUTO_TEST_CASE (btck_script_pubkey)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_output)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_input)
 
 BOOST_AUTO_TEST_CASE (btck_precomputed_txdata)
 
 BOOST_AUTO_TEST_CASE (btck_script_verify_tests)
 
 BOOST_AUTO_TEST_CASE (logging_connection_tests)
 This test is focused on the public kernel logging interface, to the extent it is testable.
 
 BOOST_AUTO_TEST_CASE (btck_chainparams_tests)
 
 BOOST_AUTO_TEST_CASE (btck_context_tests)
 
 BOOST_AUTO_TEST_CASE (btck_block_header_tests)
 
 BOOST_AUTO_TEST_CASE (btck_block)
 
Context create_context (std::shared_ptr< TestKernelNotifications > notifications, ChainType chain_type, std::shared_ptr< TestValidationInterface > validation_interface=nullptr)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_tests)
 
std::unique_ptr< ChainMan > create_chainman (TestDirectory &test_directory, bool reindex, bool wipe_chainstate, bool block_tree_db_in_memory, bool chainstate_db_in_memory, Context &context)
 
void chainman_reindex_test (TestDirectory &test_directory)
 
void chainman_reindex_chainstate_test (TestDirectory &test_directory)
 
void chainman_mainnet_validation_test (TestDirectory &test_directory)
 
 BOOST_AUTO_TEST_CASE (btck_check_block_context_free)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_mainnet_tests)
 
 BOOST_AUTO_TEST_CASE (btck_block_hash_tests)
 
 BOOST_AUTO_TEST_CASE (btck_block_tree_entry_tests)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_in_memory_tests)
 
 BOOST_AUTO_TEST_CASE (btck_chainman_regtest_tests)
 
 BOOST_AUTO_TEST_CASE (btck_transaction_check_tests)
 
 BOOST_AUTO_TEST_CASE (btck_set_mock_time_tests)
 

Variables

constexpr auto VERIFY_ALL_PRE_SEGWIT
 
constexpr auto VERIFY_ALL_PRE_TAPROOT {VERIFY_ALL_PRE_SEGWIT | ScriptVerificationFlags::WITNESS}
 

Macro Definition Documentation

◆ BOOST_TEST_DISABLE_ALT_STACK

#define BOOST_TEST_DISABLE_ALT_STACK

Definition at line 11 of file test_kernel.cpp.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Bitcoin Kernel Test Suite

Definition at line 12 of file test_kernel.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/21]

BOOST_AUTO_TEST_CASE ( btck_block  )

Definition at line 821 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/21]

BOOST_AUTO_TEST_CASE ( btck_block_hash_tests  )

Definition at line 1115 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/21]

BOOST_AUTO_TEST_CASE ( btck_block_header_tests  )

Definition at line 779 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/21]

BOOST_AUTO_TEST_CASE ( btck_block_tree_entry_tests  )

Definition at line 1130 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/21]

BOOST_AUTO_TEST_CASE ( btck_chainman_in_memory_tests  )

Definition at line 1177 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/21]

BOOST_AUTO_TEST_CASE ( btck_chainman_mainnet_tests  )

Definition at line 1107 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/21]

BOOST_AUTO_TEST_CASE ( btck_chainman_regtest_tests  )

Definition at line 1201 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/21]

BOOST_AUTO_TEST_CASE ( btck_chainman_tests  )

Definition at line 853 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/21]

BOOST_AUTO_TEST_CASE ( btck_chainparams_tests  )

Definition at line 748 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/21]

BOOST_AUTO_TEST_CASE ( btck_check_block_context_free  )

Definition at line 1048 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/21]

BOOST_AUTO_TEST_CASE ( btck_context_tests  )

Definition at line 755 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/21]

BOOST_AUTO_TEST_CASE ( btck_precomputed_txdata  )

Definition at line 592 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/21]

BOOST_AUTO_TEST_CASE ( btck_script_pubkey  )

Definition at line 531 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/21]

BOOST_AUTO_TEST_CASE ( btck_script_verify_tests  )

Definition at line 608 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/21]

BOOST_AUTO_TEST_CASE ( btck_set_mock_time_tests  )

Definition at line 1519 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [16/21]

BOOST_AUTO_TEST_CASE ( btck_transaction_check_tests  )

Definition at line 1390 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [17/21]

BOOST_AUTO_TEST_CASE ( btck_transaction_id_tests  )

Definition at line 491 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [18/21]

BOOST_AUTO_TEST_CASE ( btck_transaction_input  )

Definition at line 553 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [19/21]

BOOST_AUTO_TEST_CASE ( btck_transaction_output  )

Definition at line 545 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [20/21]

BOOST_AUTO_TEST_CASE ( btck_transaction_tests  )

Definition at line 401 of file test_kernel.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [21/21]

BOOST_AUTO_TEST_CASE ( logging_connection_tests  )

This test is focused on the public kernel logging interface, to the extent it is testable.

Definition at line 718 of file test_kernel.cpp.

Here is the call graph for this function:

◆ byte_span_to_hex_string_reversed()

std::string byte_span_to_hex_string_reversed ( std::span< const std::byte >  bytes)

Definition at line 71 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chainman_mainnet_validation_test()

void chainman_mainnet_validation_test ( TestDirectory &  test_directory)

Definition at line 984 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chainman_reindex_chainstate_test()

void chainman_reindex_chainstate_test ( TestDirectory &  test_directory)

Definition at line 971 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chainman_reindex_test()

void chainman_reindex_test ( TestDirectory &  test_directory)

Definition at line 926 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_equal()

void check_equal ( std::span< const std::byte >  _actual,
std::span< const std::byte >  _expected 
)

Definition at line 89 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckHandle()

template<typename T >
void CheckHandle ( T  object,
T  distinct_object 
)

Definition at line 273 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckRange()

void CheckRange ( const RangeType &  range,
size_t  expected_size 
)

Definition at line 331 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_chainman()

std::unique_ptr< ChainMan > create_chainman ( TestDirectory &  test_directory,
bool  reindex,
bool  wipe_chainstate,
bool  block_tree_db_in_memory,
bool  chainstate_db_in_memory,
Context &  context 
)

Definition at line 900 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_context()

Context create_context ( std::shared_ptr< TestKernelNotifications >  notifications,
ChainType  chain_type,
std::shared_ptr< TestValidationInterface >  validation_interface = nullptr 
)

Definition at line 840 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hex_string_to_byte_vec()

std::vector< std::byte > hex_string_to_byte_vec ( std::string_view  hex)

Definition at line 54 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ random_string()

std::string random_string ( uint32_t  length)

Definition at line 36 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_verify_test()

void run_verify_test ( const ScriptPubkey &  spent_script_pubkey,
const Transaction &  spending_tx,
const PrecomputedTransactionData *  precomputed_txdata,
int64_t  amount,
unsigned int  input_index,
bool  taproot 
)

Definition at line 218 of file test_kernel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ VERIFY_ALL_PRE_SEGWIT

constexpr auto VERIFY_ALL_PRE_SEGWIT
constexpr
Initial value:
{ScriptVerificationFlags::P2SH | ScriptVerificationFlags::DERSIG |
ScriptVerificationFlags::NULLDUMMY | ScriptVerificationFlags::CHECKLOCKTIMEVERIFY |
ScriptVerificationFlags::CHECKSEQUENCEVERIFY}

Definition at line 84 of file test_kernel.cpp.

◆ VERIFY_ALL_PRE_TAPROOT

constexpr auto VERIFY_ALL_PRE_TAPROOT {VERIFY_ALL_PRE_SEGWIT | ScriptVerificationFlags::WITNESS}
constexpr

Definition at line 87 of file test_kernel.cpp.