Bitcoin ABC 0.30.5
P2P Digital Currency
Functions | Variables
chained_tx.cpp File Reference
#include <bench/bench.h>
#include <common/system.h>
#include <config.h>
#include <consensus/amount.h>
#include <node/context.h>
#include <node/miner.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <txmempool.h>
#include <util/string.h>
#include <validation.h>
#include <test/util/mining.h>
#include <test/util/setup_common.h>
#include <list>
#include <queue>
#include <vector>
Include dependency graph for chained_tx.cpp:

Go to the source code of this file.

Functions

static std::vector< CTxIncreateUTXOs (const Config &config, size_t n, node::NodeContext &node)
 Mine new utxos. More...
 
static CTransactionRef toTx (const Config &config, CTxIn txin)
 Create a transaction spending a coinbase utxo. More...
 
static std::vector< CTransactionRefoneInOneOutChain (const Config &config, CTxIn utxo, const size_t chainLength)
 Creates a chain of transactions with 1-input-1-output. More...
 
static std::vector< CTransactionReftwoInOneOutTree (const Config &config, node::NodeContext &node, const size_t treeDepth)
 Creates a tree of transactions with 2-inputs-1-output. More...
 
static void benchATMP (node::NodeContext &node, benchmark::Bench &bench, const std::vector< CTransactionRef > chainedTxs)
 Run benchmark on AcceptToMemoryPool. More...
 
static void benchReorg (const Config &config, node::NodeContext &node, benchmark::Bench &bench, size_t reorgDepth, size_t chainSizePerBlock, bool includeMempoolTxRemoval)
 Run benchmark that reorganizes blocks with one-input-one-output transaction chains in them. More...
 
static void benchGenerateNewBlock (const Config &config, node::NodeContext &node, benchmark::Bench &bench, const std::vector< std::vector< CTransactionRef > > &chains)
 
static void benchEviction (const Config &, benchmark::Bench &bench, const std::vector< std::vector< CTransactionRef > > &chains, bool revFee=true)
 
static void MempoolAcceptance50ChainedTxs (benchmark::Bench &bench)
 Tests a chain of 50 1-input-1-output transactions. More...
 
static void MempoolAcceptance500ChainedTxs (benchmark::Bench &bench)
 Tests a chain of 500 1-input-1-output transactions. More...
 
static void MempoolAcceptance63TxTree (benchmark::Bench &bench)
 Test a tree of 63 2-inputs-1-output transactions. More...
 
static void MempoolAcceptance511TxTree (benchmark::Bench &bench)
 Test a tree of 511 2-inputs-1-output transactions. More...
 
static void Reorg10BlocksWith50TxChain (benchmark::Bench &bench)
 Try to reorg a chain of depth 10 where each block has a 50 tx 1-input-1-output chain. More...
 
static void Reorg10BlocksWith500TxChain (benchmark::Bench &bench)
 Try to reorg a chain of depth 10 where each block has a 500 tx 1-input-1-output chain. More...
 
static void Reorg10BlocksWith50TxChainSkipMempool (benchmark::Bench &bench)
 Try to reorg a chain of depth 10 where each block has a 50 tx 1-input-1-output chain, skipping the process of removing transactions from the mempool during re-connect. More...
 
static void Reorg10BlocksWith500TxChainSkipMempool (benchmark::Bench &bench)
 Try to reorg a chain of depth 10 where each block has a 500 tx 1-input-1-output chain, skipping the process of removing transactions from the mempool during re-connect. More...
 
static void GenerateBlock50ChainedTxs (benchmark::Bench &bench)
 Generate a block with 50 1-input-1-output transactions. More...
 
static void GenerateBlock500ChainedTxs (benchmark::Bench &bench)
 Generate a block with 500 1-input-1-output transactions. More...
 
static void EvictChained50Tx (benchmark::Bench &bench)
 Fill a mempool then evict 2000 x 50 1-input-1-output transactions, CTxMemPool version, in order of increasing fee. More...
 
static void EvictChained50TxRev (benchmark::Bench &bench)
 Fill a mempool then evict 2000 x 50 1-input-1-output transactions, CTxMemPool version, in order of decreasing fee. More...
 
 BENCHMARK (MempoolAcceptance50ChainedTxs)
 
 BENCHMARK (MempoolAcceptance500ChainedTxs)
 
 BENCHMARK (MempoolAcceptance63TxTree)
 
 BENCHMARK (MempoolAcceptance511TxTree)
 
 BENCHMARK (Reorg10BlocksWith50TxChain)
 
 BENCHMARK (Reorg10BlocksWith500TxChain)
 
 BENCHMARK (Reorg10BlocksWith50TxChainSkipMempool)
 
 BENCHMARK (Reorg10BlocksWith500TxChainSkipMempool)
 
 BENCHMARK (GenerateBlock50ChainedTxs)
 
 BENCHMARK (GenerateBlock500ChainedTxs)
 
 BENCHMARK (EvictChained50Tx)
 
 BENCHMARK (EvictChained50TxRev)
 

Variables

static const CScript REDEEM_SCRIPT = CScript() << OP_DROP << OP_TRUE
 This file contains benchmarks focusing on chained transactions in the mempool. More...
 
static const CScript SCRIPT_PUB_KEY
 
static const CScript SCRIPT_SIG
 

Function Documentation

◆ benchATMP()

static void benchATMP ( node::NodeContext node,
benchmark::Bench bench,
const std::vector< CTransactionRef chainedTxs 
)
static

Run benchmark on AcceptToMemoryPool.

Definition at line 131 of file chained_tx.cpp.

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

◆ benchEviction()

static void benchEviction ( const Config ,
benchmark::Bench bench,
const std::vector< std::vector< CTransactionRef > > &  chains,
bool  revFee = true 
)
static

Definition at line 270 of file chained_tx.cpp.

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

◆ benchGenerateNewBlock()

static void benchGenerateNewBlock ( const Config config,
node::NodeContext node,
benchmark::Bench bench,
const std::vector< std::vector< CTransactionRef > > &  chains 
)
static

Definition at line 237 of file chained_tx.cpp.

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

◆ BENCHMARK() [1/12]

BENCHMARK ( EvictChained50Tx  )

◆ BENCHMARK() [2/12]

BENCHMARK ( EvictChained50TxRev  )

◆ BENCHMARK() [3/12]

BENCHMARK ( GenerateBlock500ChainedTxs  )

◆ BENCHMARK() [4/12]

BENCHMARK ( GenerateBlock50ChainedTxs  )

◆ BENCHMARK() [5/12]

◆ BENCHMARK() [6/12]

◆ BENCHMARK() [7/12]

BENCHMARK ( MempoolAcceptance511TxTree  )

◆ BENCHMARK() [8/12]

BENCHMARK ( MempoolAcceptance63TxTree  )

◆ BENCHMARK() [9/12]

BENCHMARK ( Reorg10BlocksWith500TxChain  )

◆ BENCHMARK() [10/12]

◆ BENCHMARK() [11/12]

BENCHMARK ( Reorg10BlocksWith50TxChain  )

◆ BENCHMARK() [12/12]

◆ benchReorg()

static void benchReorg ( const Config config,
node::NodeContext node,
benchmark::Bench bench,
size_t  reorgDepth,
size_t  chainSizePerBlock,
bool  includeMempoolTxRemoval 
)
static

Run benchmark that reorganizes blocks with one-input-one-output transaction chains in them.

If 'includeMempoolTxRemoval' is set, the benchmark will include the time it takes to remove the transactions of re-connected blocks from the mempool.

Definition at line 157 of file chained_tx.cpp.

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

◆ createUTXOs()

static std::vector< CTxIn > createUTXOs ( const Config config,
size_t  n,
node::NodeContext node 
)
static

Mine new utxos.

Definition at line 37 of file chained_tx.cpp.

Here is the caller graph for this function:

◆ EvictChained50Tx()

static void EvictChained50Tx ( benchmark::Bench bench)
static

Fill a mempool then evict 2000 x 50 1-input-1-output transactions, CTxMemPool version, in order of increasing fee.

Definition at line 419 of file chained_tx.cpp.

Here is the call graph for this function:

◆ EvictChained50TxRev()

static void EvictChained50TxRev ( benchmark::Bench bench)
static

Fill a mempool then evict 2000 x 50 1-input-1-output transactions, CTxMemPool version, in order of decreasing fee.

Definition at line 434 of file chained_tx.cpp.

Here is the call graph for this function:

◆ GenerateBlock500ChainedTxs()

static void GenerateBlock500ChainedTxs ( benchmark::Bench bench)
static

Generate a block with 500 1-input-1-output transactions.

Definition at line 409 of file chained_tx.cpp.

Here is the call graph for this function:

◆ GenerateBlock50ChainedTxs()

static void GenerateBlock50ChainedTxs ( benchmark::Bench bench)
static

Generate a block with 50 1-input-1-output transactions.

Definition at line 400 of file chained_tx.cpp.

Here is the call graph for this function:

◆ MempoolAcceptance500ChainedTxs()

static void MempoolAcceptance500ChainedTxs ( benchmark::Bench bench)
static

Tests a chain of 500 1-input-1-output transactions.

Definition at line 337 of file chained_tx.cpp.

Here is the call graph for this function:

◆ MempoolAcceptance50ChainedTxs()

static void MempoolAcceptance50ChainedTxs ( benchmark::Bench bench)
static

Tests a chain of 50 1-input-1-output transactions.

Definition at line 328 of file chained_tx.cpp.

Here is the call graph for this function:

◆ MempoolAcceptance511TxTree()

static void MempoolAcceptance511TxTree ( benchmark::Bench bench)
static

Test a tree of 511 2-inputs-1-output transactions.

Definition at line 356 of file chained_tx.cpp.

Here is the call graph for this function:

◆ MempoolAcceptance63TxTree()

static void MempoolAcceptance63TxTree ( benchmark::Bench bench)
static

Test a tree of 63 2-inputs-1-output transactions.

Definition at line 346 of file chained_tx.cpp.

Here is the call graph for this function:

◆ oneInOneOutChain()

static std::vector< CTransactionRef > oneInOneOutChain ( const Config config,
CTxIn  utxo,
const size_t  chainLength 
)
static

Creates a chain of transactions with 1-input-1-output.

Definition at line 64 of file chained_tx.cpp.

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

◆ Reorg10BlocksWith500TxChain()

static void Reorg10BlocksWith500TxChain ( benchmark::Bench bench)
static

Try to reorg a chain of depth 10 where each block has a 500 tx 1-input-1-output chain.

Definition at line 375 of file chained_tx.cpp.

Here is the call graph for this function:

◆ Reorg10BlocksWith500TxChainSkipMempool()

static void Reorg10BlocksWith500TxChainSkipMempool ( benchmark::Bench bench)
static

Try to reorg a chain of depth 10 where each block has a 500 tx 1-input-1-output chain, skipping the process of removing transactions from the mempool during re-connect.

Definition at line 393 of file chained_tx.cpp.

Here is the call graph for this function:

◆ Reorg10BlocksWith50TxChain()

static void Reorg10BlocksWith50TxChain ( benchmark::Bench bench)
static

Try to reorg a chain of depth 10 where each block has a 50 tx 1-input-1-output chain.

Definition at line 367 of file chained_tx.cpp.

Here is the call graph for this function:

◆ Reorg10BlocksWith50TxChainSkipMempool()

static void Reorg10BlocksWith50TxChainSkipMempool ( benchmark::Bench bench)
static

Try to reorg a chain of depth 10 where each block has a 50 tx 1-input-1-output chain, skipping the process of removing transactions from the mempool during re-connect.

Definition at line 384 of file chained_tx.cpp.

Here is the call graph for this function:

◆ toTx()

static CTransactionRef toTx ( const Config config,
CTxIn  txin 
)
static

Create a transaction spending a coinbase utxo.

Definition at line 54 of file chained_tx.cpp.

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

◆ twoInOneOutTree()

static std::vector< CTransactionRef > twoInOneOutTree ( const Config config,
node::NodeContext node,
const size_t  treeDepth 
)
static

Creates a tree of transactions with 2-inputs-1-output.

It has similar properties to a complete binary-tree, where the last transaction is the "top" of the tree.

Definition at line 85 of file chained_tx.cpp.

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

Variable Documentation

◆ REDEEM_SCRIPT

const CScript REDEEM_SCRIPT = CScript() << OP_DROP << OP_TRUE
static

This file contains benchmarks focusing on chained transactions in the mempool.

Definition at line 27 of file chained_tx.cpp.

◆ SCRIPT_PUB_KEY

const CScript SCRIPT_PUB_KEY
static
Initial value:
=
static const CScript REDEEM_SCRIPT
This file contains benchmarks focusing on chained transactions in the mempool.
Definition: chained_tx.cpp:27
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:24
@ OP_EQUAL
Definition: script.h:119
@ OP_HASH160
Definition: script.h:160
std::vector< uint8_t > ToByteVector(const T &in)
Definition: script.h:42

Definition at line 29 of file chained_tx.cpp.

◆ SCRIPT_SIG

const CScript SCRIPT_SIG
static
Initial value:
= CScript() << std::vector<uint8_t>(100, 0xff)

Definition at line 33 of file chained_tx.cpp.