15#include <validation.h>
49 for (
auto x = 0; x < 10; ++x) {
54 tx.
vin[0].scriptWitness.stack.push_back(
CScriptNum(x).getvch());
56 for (
auto& out : tx.
vout) {
58 out.nValue = 10 *
COIN;
69 Txid hash = coin.
ref->GetHash();
75 tx.
vin.emplace_back();
85 for (
auto& out : tx.
vout) {
87 out.nValue = 10 *
COIN;
100 if (
bench.complexityN() > 1) {
106 std::vector<CTransactionRef> transactions;
108 for (
int i=0; i<100; i++) {
110 transactions.insert(transactions.end(),
new_txs.begin(),
new_txs.end());
116 for (
auto& tx : transactions) {
127 if (
bench.complexityN() > 1) {
138 for (
int i=0; i<1000; i++) {
145 for (
auto& tx : transactions) {
171 if (
bench.complexityN() > 1) {
180 for (
auto& tx : transactions) {
202 testing_setup->PopulateMempool(
det_rand, 400,
true);
static constexpr CAmount COIN
The amount of satoshis in one BTC.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
std::vector< unsigned char > getvch() const
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
std::optional< txiter > GetIter(const Txid &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Returns an iterator to the given hash, if found.
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
void TrimToSize(size_t sizelimit, std::vector< COutPoint > *pvNoSpendsRemaining=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs)
Remove transactions from the mempool until its dynamic size is <= sizelimit.
void UpdateTransactionsFromBlock(const std::vector< Txid > &vHashesToUpdate) EXCLUSIVE_LOCKS_REQUIRED(cs
UpdateTransactionsFromBlock is called when adding transactions from a disconnected block back to the ...
CTransactionRef get(const Txid &hash) const
std::set< txiter, CompareIteratorByHash > setEntries
void removeForBlock(const std::vector< CTransactionRef > &vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs)
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
void CalculateDescendants(txiter it, setEntries &setDescendants) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Populate setDescendants with all in-mempool descendants of given transaction.
setEntries CalculateMemPoolAncestors(const CTxMemPoolEntry &entry) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Calculate all in-mempool ancestors of entry (not including the tx itself)
Main entry point to nanobench's benchmarking facility.
static transaction_identifier FromUint256(const uint256 &id)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
TryAddToMempool(pool, CTxMemPoolEntry(tx, det_rand.randrange(10000)+1000, nTime, nHeight, sequence, spendsCoinbase, sigOpCost, lp))
static void MempoolCheck(benchmark::Bench &bench)
static std::vector< CTransactionRef > CreateCoinCluster(FastRandomContext &det_rand, int childTxs, int min_ancestors)
static void MemPoolAncestorsDescendants(benchmark::Bench &bench)
static void MemPoolAddTransactions(benchmark::Bench &bench)
static void AddTx(const CTransactionRef &tx, CTxMemPool &pool, FastRandomContext &det_rand) EXCLUSIVE_LOCKS_REQUIRED(cs_main
static void ComplexMemPool(benchmark::Bench &bench)
void doNotOptimizeAway(Arg &&arg)
Makes sure none of the given arguments are optimized away by the compiler.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
uint256 GetRandHash() noexcept
Generate a random uint256.
Available(CTransactionRef &ref, size_t tx_count)
A mutable version of CTransaction.
std::vector< CTxOut > vout
#define EXCLUSIVE_LOCKS_REQUIRED(...)
#define NO_THREAD_SAFETY_ANALYSIS
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.