5 #include <chainparams.h> 30 }
catch (
const std::ios_base::failure&) {
35 const bool valid_incl_pow_and_merkle =
CheckBlock(block, validation_state_pow_and_merkle, consensus_params,
true,
true);
36 assert(validation_state_pow_and_merkle.
IsValid() || validation_state_pow_and_merkle.
IsInvalid() || validation_state_pow_and_merkle.
IsError());
37 (void)validation_state_pow_and_merkle.
Error(
"");
39 const bool valid_incl_pow =
CheckBlock(block, validation_state_pow, consensus_params,
true,
false);
42 const bool valid_incl_merkle =
CheckBlock(block, validation_state_merkle, consensus_params,
false,
true);
43 assert(validation_state_merkle.IsValid() || validation_state_merkle.IsInvalid() || validation_state_merkle.IsError());
45 const bool valid_incl_none =
CheckBlock(block, validation_state_none, consensus_params,
false,
false);
46 assert(validation_state_none.IsValid() || validation_state_none.IsInvalid() || validation_state_none.IsError());
47 if (valid_incl_pow_and_merkle) {
48 assert(valid_incl_pow && valid_incl_merkle && valid_incl_none);
49 }
else if (valid_incl_merkle || valid_incl_pow) {
55 if (!block.
vtx.empty()) {
62 assert(raw_memory_size_as_shared_ptr > raw_memory_size);
65 const bool is_null = block_copy.
IsNull();
bool Error(const std::string &reject_reason)
std::string ToString() const
Minimal stream for reading from an existing byte array by std::span.
FUZZ_TARGET(block,.init=initialize_block)
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.
uint256 BlockWitnessMerkleRoot(const CBlock &block)
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.
static constexpr TransactionSerParams TX_WITH_WITNESS