7#include <chainparams.h>
15#include <test/util/setup_common.h>
20 const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
22 const CScript SCRIPT_PUB{CScript(
OP_TRUE)};
24 const Config &config = testing_setup->m_node.chainman->GetConfig();
34 testing_setup->m_node.chainman->ActiveChain().Tip();
35 assert(pindexPrev !=
nullptr);
41 coinbaseTx.vin.resize(1);
42 coinbaseTx.vin[0].prevout = COutPoint();
43 coinbaseTx.vout.resize(1);
44 coinbaseTx.vout[0].scriptPubKey = SCRIPT_PUB;
46 coinbaseTx.vin[0].scriptSig = CScript() <<
nHeight <<
OP_0;
48 naughtyTx.vout.resize(1);
50 naughtyTx.vout[0].scriptPubKey = SCRIPT_PUB;
53 ((
MAX_TX_SIZE - CTransaction(naughtyTx).GetTotalSize()) / 41) - 100;
54 for (uint64_t x = 0; x < (n_inputs - 1); ++x) {
57 naughtyTx.vin.emplace_back(naughtyTx.vin.back());
69 .withCheckMerkleRoot(
false)));
70 assert(cvstate.GetRejectReason() ==
"bad-txns-inputs-duplicate");
The block chain is a tree shaped structure starting with the genesis block at the root,...
int nHeight
height of the entry in the chain. The genesis block has height 0
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
const Consensus::Params & GetConsensus() const
A mutable version of CTransaction.
virtual const CChainParams & GetChainParams() const =0
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.
static const uint64_t MAX_TX_SIZE
The maximum allowed size for a transaction, in bytes.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
Compute the Merkle root of the transactions in a block.
bool CheckBlock(const CCheckpointData &data, int nHeight, const BlockHash &hash)
Returns true if block passes checkpoint checks.
uint32_t GetNextWorkRequired(const CBlockIndex *pindexPrev, const CBlockHeader *pblock, const CChainParams &chainParams)
static CTransactionRef MakeTransactionRef()
uint256 GetRandHash() noexcept
static constexpr Amount zero() noexcept
Parameters that influence chain consensus.
A TxId is the identifier of a transaction.
Amount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams)