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

Function IsDefinedHashtypeSignature

src/script/interpreter.cpp:271–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271bool static IsDefinedHashtypeSignature(const valtype &vchSig, unsigned int flags) {
272 if (vchSig.size() == 0) {
273 return false;
274 }
275 unsigned char nHashType = vchSig[vchSig.size() - 1] & (~(SIGHASH_ANYONECANPAY));
276
277 // ELEMENTS: Only allow SIGHASH_RANGEPROOF if the flag is set (after dynafed activation).
278 if ((flags & SCRIPT_SIGHASH_RANGEPROOF) == SCRIPT_SIGHASH_RANGEPROOF) {
279 nHashType = nHashType & (~(SIGHASH_RANGEPROOF));
280 }
281
282 if (nHashType < SIGHASH_ALL || nHashType > SIGHASH_SINGLE)
283 return false;
284
285 return true;
286}
287
288bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror) {
289 // Empty signature. Not strictly DER encoded, but allowed to provide a

Callers 1

CheckSignatureEncodingFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected