Bitcoin Core 28.99.0
P2P Digital Currency
Classes | Typedefs | Functions | Variables
disconnected_transactions.cpp File Reference
#include <bench/bench.h>
#include <kernel/disconnected_transactions.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <test/util/setup_common.h>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <memory>
#include <vector>
Include dependency graph for disconnected_transactions.cpp:

Go to the source code of this file.

Classes

struct  ReorgTxns
 Reorg where 1 block is disconnected and 2 blocks are connected. More...
 

Typedefs

using BlockTxns = decltype(CBlock::vtx)
 

Functions

static BlockTxns CreateRandomTransactions (size_t num_txns)
 
static ReorgTxns CreateBlocks (size_t num_not_shared)
 Creates blocks for a Reorg, each with BLOCK_VTX_COUNT transactions. More...
 
static void Reorg (const ReorgTxns &reorg)
 
static void AddAndRemoveDisconnectedBlockTransactionsAll (benchmark::Bench &bench)
 Add transactions from DisconnectedBlockTransactions, remove all but one (the disconnected block's coinbase transaction) of them, and then pop from the front until empty. More...
 
static void AddAndRemoveDisconnectedBlockTransactions90 (benchmark::Bench &bench)
 Add transactions from DisconnectedBlockTransactions, remove 90% of them, and then pop from the front until empty. More...
 
static void AddAndRemoveDisconnectedBlockTransactions10 (benchmark::Bench &bench)
 Add transactions from DisconnectedBlockTransactions, remove 10% of them, and then pop from the front until empty. More...
 
 BENCHMARK (AddAndRemoveDisconnectedBlockTransactionsAll, benchmark::PriorityLevel::HIGH)
 
 BENCHMARK (AddAndRemoveDisconnectedBlockTransactions90, benchmark::PriorityLevel::HIGH)
 
 BENCHMARK (AddAndRemoveDisconnectedBlockTransactions10, benchmark::PriorityLevel::HIGH)
 

Variables

constexpr size_t BLOCK_VTX_COUNT {4000}
 
constexpr size_t BLOCK_VTX_COUNT_10PERCENT {400}
 

Typedef Documentation

◆ BlockTxns

using BlockTxns = decltype(CBlock::vtx)

Definition at line 23 of file disconnected_transactions.cpp.

Function Documentation

◆ AddAndRemoveDisconnectedBlockTransactions10()

static void AddAndRemoveDisconnectedBlockTransactions10 ( benchmark::Bench bench)
static

Add transactions from DisconnectedBlockTransactions, remove 10% of them, and then pop from the front until empty.

Definition at line 127 of file disconnected_transactions.cpp.

Here is the call graph for this function:

◆ AddAndRemoveDisconnectedBlockTransactions90()

static void AddAndRemoveDisconnectedBlockTransactions90 ( benchmark::Bench bench)
static

Add transactions from DisconnectedBlockTransactions, remove 90% of them, and then pop from the front until empty.

Definition at line 116 of file disconnected_transactions.cpp.

Here is the call graph for this function:

◆ AddAndRemoveDisconnectedBlockTransactionsAll()

static void AddAndRemoveDisconnectedBlockTransactionsAll ( benchmark::Bench bench)
static

Add transactions from DisconnectedBlockTransactions, remove all but one (the disconnected block's coinbase transaction) of them, and then pop from the front until empty.

This is a reorg in which all of the non-coinbase transactions in the disconnected chain also exist in the new chain.

Definition at line 105 of file disconnected_transactions.cpp.

Here is the call graph for this function:

◆ BENCHMARK() [1/3]

◆ BENCHMARK() [2/3]

◆ BENCHMARK() [3/3]

◆ CreateBlocks()

static ReorgTxns CreateBlocks ( size_t  num_not_shared)
static

Creates blocks for a Reorg, each with BLOCK_VTX_COUNT transactions.

Between the disconnected block and the first connected block, there will be num_not_shared transactions that are different, and all other transactions the exact same. The second connected block has all unique transactions. This is to simulate a reorg in which all but num_not_shared transactions are confirmed in the new chain.

Definition at line 62 of file disconnected_transactions.cpp.

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

◆ CreateRandomTransactions()

static BlockTxns CreateRandomTransactions ( size_t  num_txns)
static

Definition at line 37 of file disconnected_transactions.cpp.

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

◆ Reorg()

static void Reorg ( const ReorgTxns reorg)
static

Definition at line 83 of file disconnected_transactions.cpp.

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

Variable Documentation

◆ BLOCK_VTX_COUNT

constexpr size_t BLOCK_VTX_COUNT {4000}
constexpr

Definition at line 20 of file disconnected_transactions.cpp.

◆ BLOCK_VTX_COUNT_10PERCENT

constexpr size_t BLOCK_VTX_COUNT_10PERCENT {400}
constexpr

Definition at line 21 of file disconnected_transactions.cpp.