43 if (!
found_header &&
pushdata.size() > header.size() && std::ranges::equal(std::span{pushdata}.first(header.size()), header)) {
45 result.insert(result.end(),
pushdata.begin() + header.size(),
pushdata.end());
61 std::vector<uint256> leaves;
62 leaves.reserve((block.
vtx.size() + 1) & ~1ULL);
63 leaves.push_back(
cb.GetHash().ToUint256());
64 for (
size_t s = 1; s < block.
vtx.size(); ++s) {
65 leaves.push_back(block.
vtx[s]->GetHash().ToUint256());
88 if (block.
vtx.empty())
return std::nullopt;
106 if (!v.empty())
return std::nullopt;
107 }
catch (
const std::exception&) {
145 txdata.
Init(
signet_txs->m_to_sign, {signet_txs->m_to_spend.vout[0]});
std::vector< CTransactionRef > vtx
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
Generate the signet tx corresponding to the given block.
static std::optional< SignetTxs > Create(const CBlock &block, const CScript &challenge)
Minimal stream for reading from an existing byte array by std::span.
uint256 ComputeMerkleRoot(std::vector< uint256 > hashes, bool *mutated)
static constexpr int NO_WITNESS_COMMITMENT
Index marker for when no witness commitment is present in a coinbase transaction.
int GetWitnessCommitmentIndex(const CBlock &block)
Compute at which vout of the block's coinbase transaction the witness commitment occurs,...
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, script_verify_flags flags, const BaseSignatureChecker &checker, ScriptError *serror)
@ ASSERT_FAIL
Abort execution through assertion failure (for consensus code)
@ SCRIPT_VERIFY_NULLDUMMY
#define LogDebug(category,...)
opcodetype
Script opcodes.
bool CheckSignetBlockSolution(const CBlock &block, const Consensus::Params &consensusParams)
Extract signature and check whether a block has a valid solution.
static constexpr script_verify_flags BLOCK_SCRIPT_VERIFY_FLAGS
static bool FetchAndClearCommitmentSection(const std::span< const uint8_t > header, CScript &witness_commitment, std::vector< uint8_t > &result)
static constexpr uint8_t SIGNET_HEADER[4]
static uint256 ComputeModifiedMerkleRoot(const CMutableTransaction &cb, const CBlock &block)
A mutable version of CTransaction.
Parameters that influence chain consensus.
void Init(const T &tx, std::vector< CTxOut > &&spent_outputs, bool force=false)
Initialize this PrecomputedTransactionData with transaction data.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.