mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
This is a follow-up to previous commits moving the chain constants out of chainparamsbase. The script removes the chainparamsbase header in all files where it is included, but not used. This is done by filtering against all defined symbols of the header as well as its respective .cpp file. The kernel chainparams now no longer relies on chainparamsbase. -BEGIN VERIFY SCRIPT- sed -i '/#include <chainparamsbase.h>/d' $( git grep -l 'chainparamsbase.h' | xargs grep -L 'CBaseChainParams\|CreateBaseChainParams\|SetupChainParamsBaseOptions\|BaseParams\|SelectBaseParams\|chainparamsbase.cpp' ) -END VERIFY SCRIPT-
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
// Copyright (c) 2011-2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <bench/bench.h>
|
|
#include <kernel/cs_main.h>
|
|
#include <kernel/mempool_entry.h>
|
|
#include <rpc/mempool.h>
|
|
#include <test/util/setup_common.h>
|
|
#include <txmempool.h>
|
|
#include <util/chaintype.h>
|
|
|
|
#include <univalue.h>
|
|
|
|
|
|
static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)
|
|
{
|
|
LockPoints lp;
|
|
pool.addUnchecked(CTxMemPoolEntry(tx, fee, /*time=*/0, /*entry_height=*/1, /*spends_coinbase=*/false, /*sigops_cost=*/4, lp));
|
|
}
|
|
|
|
static void RpcMempool(benchmark::Bench& bench)
|
|
{
|
|
const auto testing_setup = MakeNoLogFileContext<const ChainTestingSetup>(ChainType::MAIN);
|
|
CTxMemPool& pool = *Assert(testing_setup->m_node.mempool);
|
|
LOCK2(cs_main, pool.cs);
|
|
|
|
for (int i = 0; i < 1000; ++i) {
|
|
CMutableTransaction tx = CMutableTransaction();
|
|
tx.vin.resize(1);
|
|
tx.vin[0].scriptSig = CScript() << OP_1;
|
|
tx.vin[0].scriptWitness.stack.push_back({1});
|
|
tx.vout.resize(1);
|
|
tx.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL;
|
|
tx.vout[0].nValue = i;
|
|
const CTransactionRef tx_r{MakeTransactionRef(tx)};
|
|
AddTx(tx_r, /*fee=*/i, pool);
|
|
}
|
|
|
|
bench.run([&] {
|
|
(void)MempoolToJSON(pool, /*verbose=*/true);
|
|
});
|
|
}
|
|
|
|
BENCHMARK(RpcMempool, benchmark::PriorityLevel::HIGH);
|