aboutsummaryrefslogtreecommitdiff
path: root/src/bench/bench.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-01-02 17:50:48 -0500
committerMarcoFalke <falke.marco@gmail.com>2020-01-02 17:50:56 -0500
commit17e14ac92fced92457945859463eda5d435bdd49 (patch)
tree0cab7274ff69d0444220fcd230851b24f2ba405c /src/bench/bench.cpp
parent190a4051fde736faf99681d107f0b38dd385e90c (diff)
parentfaa92a2297b4a6aebdd58d1818c428f1c0346078 (diff)
downloadbitcoin-17e14ac92fced92457945859463eda5d435bdd49.tar.xz
Merge #17781: rpc: Remove mempool global from miner
faa92a2297b4a6aebdd58d1818c428f1c0346078 rpc: Remove mempool global from miner (MarcoFalke) 6666ef13f167cfe880c2e94c09d003594d010cf3 test: Properly document blockinfo size in miner_tests (MarcoFalke) Pull request description: The miner needs read-only access to the mempool. Instead of using the mutable global `::mempool`, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools. ACKs for top commit: promag: ACK faa92a2297b4a6aebdd58d1818c428f1c0346078. fjahr: ACK faa92a2297b4a6aebdd58d1818c428f1c0346078 jnewbery: Code review ACK faa92a2297b4a6aebdd58d1818c428f1c0346078 Tree-SHA512: c44027b5d2217a724791166f3f3112c45110ac1dbb37bdae27148a0657e0d1a1d043b0d24e49fd45465ec014224d1b7eb15c92a33069ad883fa8ffeadc24735b
Diffstat (limited to 'src/bench/bench.cpp')
-rw-r--r--src/bench/bench.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp
index cc159eb191..745fd0966d 100644
--- a/src/bench/bench.cpp
+++ b/src/bench/bench.cpp
@@ -15,6 +15,8 @@
#include <numeric>
#include <regex>
+const RegTestingSetup* g_testing_setup = nullptr;
+
void benchmark::ConsolePrinter::header()
{
std::cout << "# Benchmark, evals, iterations, total, min, max, median" << std::endl;
@@ -113,6 +115,8 @@ void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double
for (const auto& p : benchmarks()) {
RegTestingSetup test{};
+ assert(g_testing_setup == nullptr);
+ g_testing_setup = &test;
{
LOCK(cs_main);
assert(::ChainActive().Height() == 0);
@@ -133,6 +137,7 @@ void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double
p.second.func(state);
}
printer.result(state);
+ g_testing_setup = nullptr;
}
printer.footer();