40 static Txid prevout_hash{};
43 txns.reserve(num_txns);
46 for (uint32_t i = 0; i < num_txns; ++i) {
51 txns.emplace_back(ptx);
52 prevout_hash = ptx->GetHash();
69 std::copy(shared_txns.begin(), shared_txns.end(), std::back_inserter(disconnected_block_txns));
72 std::copy(shared_txns.begin(), shared_txns.end(), std::back_inserter(connected_block_txns));
87 const auto evicted = disconnectpool.AddTransactionsFromBlock(reorg.
disconnected_txns);
98 disconnectpool.clear();
constexpr size_t BLOCK_VTX_COUNT_10PERCENT
static ReorgTxns CreateBlocks(size_t num_not_shared)
Creates blocks for a Reorg, each with BLOCK_VTX_COUNT transactions.
static void AddAndRemoveDisconnectedBlockTransactions90(benchmark::Bench &bench)
Add transactions from DisconnectedBlockTransactions, remove 90% of them, and then pop from the front ...
static void AddAndRemoveDisconnectedBlockTransactionsAll(benchmark::Bench &bench)
Add transactions from DisconnectedBlockTransactions, remove all but one (the disconnected block's coi...
constexpr size_t BLOCK_VTX_COUNT
static void AddAndRemoveDisconnectedBlockTransactions10(benchmark::Bench &bench)
Add transactions from DisconnectedBlockTransactions, remove 10% of them, and then pop from the front ...
BENCHMARK(AddAndRemoveDisconnectedBlockTransactionsAll, benchmark::PriorityLevel::HIGH)
static void Reorg(const ReorgTxns &reorg)
decltype(CBlock::vtx) BlockTxns
static BlockTxns CreateRandomTransactions(size_t num_txns)
std::vector< CTransactionRef > vtx
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
DisconnectedBlockTransactions.
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
ANKERL_NANOBENCH(NODISCARD) std Bench & minEpochIterations(uint64_t numIters) noexcept
Sets the minimum number of iterations each epoch should take.
static const unsigned int MAX_DISCONNECTED_TX_POOL_BYTES
Maximum bytes for transactions to store for processing during reorg.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
static constexpr CAmount CENT
A mutable version of CTransaction.
std::vector< CTxOut > vout
Reorg where 1 block is disconnected and 2 blocks are connected.
BlockTxns connected_txns_1
First connected block.
BlockTxns disconnected_txns
Disconnected block.
BlockTxns connected_txns_2
Second connected block, new chain tip.
size_t num_shared
Transactions shared between disconnected_txns and connected_txns_1.