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

Method CheckECDSASignature

src/script/interpreter.cpp:2989–3011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2987
2988template <class T>
2989bool GenericTransactionSignatureChecker<T>::CheckECDSASignature(const std::vector<unsigned char>& vchSigIn, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion, unsigned int flags) const
2990{
2991 CPubKey pubkey(vchPubKey);
2992 if (!pubkey.IsValid())
2993 return false;
2994
2995 // Hash type is one byte tacked on to the end of the signature
2996 std::vector<unsigned char> vchSig(vchSigIn);
2997 if (vchSig.empty())
2998 return false;
2999 int nHashType = vchSig.back();
3000 vchSig.pop_back();
3001
3002 // Witness sighashes need the amount.
3003 if (sigversion == SigVersion::WITNESS_V0 && amount.IsNull()) return HandleMissingData(m_mdb);
3004
3005 uint256 sighash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion, flags, this->txdata, &m_sighash_cache);
3006
3007 if (!VerifyECDSASignature(vchSig, pubkey, sighash))
3008 return false;
3009
3010 return true;
3011}
3012
3013template <class T>
3014bool GenericTransactionSignatureChecker<T>::CheckSchnorrSignature(Span<const unsigned char> sig, Span<const unsigned char> pubkey_in, SigVersion sigversion, ScriptExecutionData& execdata, ScriptError* serror) const

Callers 2

EvalChecksigPreTapscriptFunction · 0.45
EvalScriptFunction · 0.45

Calls 6

HandleMissingDataFunction · 0.85
SignatureHashFunction · 0.70
IsValidMethod · 0.45
emptyMethod · 0.45
pop_backMethod · 0.45
IsNullMethod · 0.45

Tested by

no test coverage detected