38 block.
nTime = 1231006505;
39 block.
nBits = 0x1d00ffff;
52 shorttxids.reserve(txs);
54 shorttxids.push_back(rng.
randbits<SHORTTXIDS_LENGTH*8>());
62 const auto testing_setup = MakeNoLogFileContext<const ChainTestingSetup>(
ChainType::MAIN);
68 std::vector<std::pair<Wtxid, CTransactionRef>> extratxn;
69 extratxn.reserve(n_extra);
72 std::array<std::byte,200> sigspam;
73 sigspam.fill(std::byte(42));
76 std::vector<CTransactionRef> refs;
77 refs.reserve(n_pool + n_extra);
78 for (
size_t i = 0; i < n_pool + n_extra; ++i) {
82 tx.
vin[0].scriptWitness.stack.push_back({1});
85 tx.
vout[0].nValue = i;
91 std::shuffle(refs.begin(), refs.end(), rng);
93 for (
size_t i = 0; i < n_pool; ++i) {
94 AddTx(refs[i], refs[i]->vout[0].nValue, pool);
96 for (
size_t i = n_pool; i < n_pool + n_extra; ++i) {
97 extratxn.emplace_back(refs[i]->GetWitnessHash(), refs[i]);
100 BenchCBHAST cmpctblock{rng, 3000};
104 auto res = pdb.InitData(cmpctblock, extratxn);
int64_t CAmount
Amount in satoshis (Can be negative)
static void BlockEncodingNoExtra(benchmark::Bench &bench)
AddToMempool(pool, CTxMemPoolEntry(tx, fee, 0, 1, 0, false, 4, lp))
static void BlockEncodingStdExtra(benchmark::Bench &bench)
static void BlockEncodingBench(benchmark::Bench &bench, size_t n_pool, size_t n_extra)
static void AddTx(const CTransactionRef &tx, const CAmount &fee, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main
static void BlockEncodingLargeExtra(benchmark::Bench &bench)
BENCHMARK(BlockEncodingNoExtra, benchmark::PriorityLevel::HIGH)
#define Assert(val)
Identity function.
std::vector< CTransactionRef > vtx
Serialized script, used inside transaction inputs and outputs.
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 ...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
uint64_t randbits(int bits) noexcept
Generate a random (bits)-bit integer.
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.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN
Default number of non-mempool transactions to keep around for block reconstruction.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
A mutable version of CTransaction.
std::vector< CTxOut > vout
#define EXCLUSIVE_LOCKS_REQUIRED(...)