5 #include <chainparams.h> 35 }
catch (
const std::ios_base::failure&) {
40 const bool valid_incl_pow_and_merkle =
CheckBlock(block, validation_state_pow_and_merkle, consensus_params,
true,
true);
41 assert(validation_state_pow_and_merkle.
IsValid() || validation_state_pow_and_merkle.
IsInvalid() || validation_state_pow_and_merkle.
IsError());
42 (void)validation_state_pow_and_merkle.
Error(
"");
44 const bool valid_incl_pow =
CheckBlock(block, validation_state_pow, consensus_params,
true,
false);
47 const bool valid_incl_merkle =
CheckBlock(block, validation_state_merkle, consensus_params,
false,
true);
48 assert(validation_state_merkle.IsValid() || validation_state_merkle.IsInvalid() || validation_state_merkle.IsError());
50 const bool valid_incl_none =
CheckBlock(block, validation_state_none, consensus_params,
false,
false);
51 assert(validation_state_none.IsValid() || validation_state_none.IsInvalid() || validation_state_none.IsError());
52 if (valid_incl_pow_and_merkle) {
53 assert(valid_incl_pow && valid_incl_merkle && valid_incl_none);
54 }
else if (valid_incl_merkle || valid_incl_pow) {
60 if (!block.
vtx.empty()) {
67 assert(raw_memory_size_as_shared_ptr > raw_memory_size);
70 const bool is_null = block_copy.
IsNull();
bool Error(const std::string &reject_reason)
std::string ToString() const
uint256 BlockWitnessMerkleRoot(const CBlock &block, bool *mutated)
FUZZ_TARGET(block,.init=initialize_block)
static const int INIT_PROTO_VERSION
initial proto version, to be increased after version/verack negotiation
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
bool CheckBlock(const CBlock &block, BlockValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW, bool fCheckMerkleRoot)
Functions for validating blocks and updating the block tree.
Parameters that influence chain consensus.
std::vector< CTransactionRef > vtx
const CChainParams & Params()
Return the currently selected parameters.
static size_t RecursiveDynamicUsage(const CScript &script)
const Consensus::Params & GetConsensus() const
int GetWitnessCommitmentIndex(const CBlock &block)
Compute at which vout of the block's coinbase transaction the witness commitment occurs, or -1 if not found.
static int64_t GetBlockWeight(const CBlock &block)
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.