Changeset View
Changeset View
Standalone View
Standalone View
src/bench/block_assemble.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | for (size_t b = 0; b < NUM_BLOCKS; ++b) { | ||||
tx.vin.back().scriptSig = scriptSig; | tx.vin.back().scriptSig = scriptSig; | ||||
tx.vout.emplace_back(1337 * SATOSHI, SCRIPT_PUB); | tx.vout.emplace_back(1337 * SATOSHI, SCRIPT_PUB); | ||||
if (NUM_BLOCKS - b >= COINBASE_MATURITY) { | if (NUM_BLOCKS - b >= COINBASE_MATURITY) { | ||||
txs.at(b) = MakeTransactionRef(tx); | txs.at(b) = MakeTransactionRef(tx); | ||||
} | } | ||||
} | } | ||||
{ | { | ||||
// Required for ::AcceptToMemoryPool. | |||||
LOCK(::cs_main); | LOCK(::cs_main); | ||||
for (const auto &txr : txs) { | for (const auto &txr : txs) { | ||||
const MempoolAcceptResult res = ::AcceptToMemoryPool( | const MempoolAcceptResult res = | ||||
test_setup.m_node.chainman->ActiveChainstate(), config, | test_setup.m_node.chainman->ProcessTransaction(txr); | ||||
*test_setup.m_node.mempool, txr, false /* bypass_limits */); | |||||
assert(res.m_result_type == MempoolAcceptResult::ResultType::VALID); | assert(res.m_result_type == MempoolAcceptResult::ResultType::VALID); | ||||
} | } | ||||
} | } | ||||
bench.run([&] { PrepareBlock(config, test_setup.m_node, SCRIPT_PUB); }); | bench.run([&] { PrepareBlock(config, test_setup.m_node, SCRIPT_PUB); }); | ||||
} | } | ||||
BENCHMARK(AssembleBlock); | BENCHMARK(AssembleBlock); |