MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CheckECDSASignature

Method CheckECDSASignature

src/script/interpreter.cpp:1702–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1700
1701template <class T>
1702bool GenericTransactionSignatureChecker<T>::CheckECDSASignature(const std::vector<unsigned char>& vchSigIn, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const
1703{
1704 CPubKey pubkey(vchPubKey);
1705 if (!pubkey.IsValid())
1706 return false;
1707
1708 // Hash type is one byte tacked on to the end of the signature
1709 std::vector<unsigned char> vchSig(vchSigIn);
1710 if (vchSig.empty())
1711 return false;
1712 int nHashType = vchSig.back();
1713 vchSig.pop_back();
1714
1715 // Witness sighashes need the amount.
1716 if (sigversion == SigVersion::WITNESS_V0 && amount < 0) return HandleMissingData(m_mdb);
1717
1718 uint256 sighash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion, this->txdata, &m_sighash_cache);
1719
1720 if (!VerifyECDSASignature(vchSig, pubkey, sighash))
1721 return false;
1722
1723 return true;
1724}
1725
1726template <class T>
1727bool GenericTransactionSignatureChecker<T>::CheckSchnorrSignature(std::span<const unsigned char> sig, std::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.85
IsValidMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected