MCPcopy Create free account
hub / github.com/ElementsProject/elements / CheckProofGeneric

Function CheckProofGeneric

src/block_proof.cpp:22–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22static bool CheckProofGeneric(const CBlockHeader& block, const uint32_t max_block_signature_size, const CScript& challenge, const CScript& scriptSig, const CScriptWitness& witness)
23{
24 // Legacy blocks have empty witness, dynafed blocks have empty scriptSig
25 bool is_dyna = !witness.stack.empty();
26
27 // Check signature limits for blocks
28 if (scriptSig.size() > max_block_signature_size) {
29 assert(!is_dyna);
30 return false;
31 } else if (witness.GetSerializedSize() > max_block_signature_size) {
32 assert(is_dyna);
33 return false;
34 }
35
36 // Some anti-DoS flags, though max_block_signature_size caps the possible
37 // danger in malleation of the block witness data.
38 unsigned int proof_flags = SCRIPT_VERIFY_P2SH // For cleanstack evaluation under segwit flag
39 | SCRIPT_VERIFY_STRICTENC // Minimally-sized DER sigs
40 | SCRIPT_VERIFY_NULLDUMMY // No extra data stuffed into OP_CMS witness
41 | SCRIPT_VERIFY_CLEANSTACK // No extra pushes leftover in witness
42 | SCRIPT_VERIFY_MINIMALDATA // Pushes are minimally-sized
43 | SCRIPT_VERIFY_SIGPUSHONLY // Witness is push-only
44 | SCRIPT_VERIFY_LOW_S // Stop easiest signature fiddling
45 | SCRIPT_VERIFY_WITNESS // Witness and to enforce cleanstack
46 | (is_dyna ? SCRIPT_VERIFY_NONE : SCRIPT_NO_SIGHASH_BYTE); // Non-dynafed blocks do not have sighash byte
47 return GenericVerifyScript(scriptSig, witness, challenge, proof_flags, block);
48}
49
50bool CheckProof(const CBlockHeader& block, const Consensus::Params& params)
51{

Callers 2

CheckProofFunction · 0.85
CheckProofSignedParentFunction · 0.85

Calls 4

GenericVerifyScriptFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
GetSerializedSizeMethod · 0.45

Tested by

no test coverage detected